diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2023-08-26 06:54:01 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-09-11 22:12:40 +0300 |
commit | 8cbba23e43eb182c75656c0dba40f890feea6400 (patch) | |
tree | 11d9aaa2b2778b51586ca9350283afa2caf658fb /drivers/iio/adc/mt6577_auxadc.c | |
parent | b564b99de79cdc87008dab3b19ae67a011f3f2fa (diff) | |
download | linux-8cbba23e43eb182c75656c0dba40f890feea6400.tar.xz |
iio: adc: mt6577_auxadc: Simplify with dev_err_probe()
Use the dev_err_probe() helper to simplify error handling during probe.
This also handle scenario, when EDEFER is returned and useless error
is printed.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Link: https://lore.kernel.org/r/20230826035402.3512033-2-ruanjinjie@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/mt6577_auxadc.c')
-rw-r--r-- | drivers/iio/adc/mt6577_auxadc.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index ea42fd7a8c99..935cf560e238 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -265,22 +265,18 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels); adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(adc_dev->reg_base)) { - dev_err(&pdev->dev, "failed to get auxadc base address\n"); - return PTR_ERR(adc_dev->reg_base); - } + if (IS_ERR(adc_dev->reg_base)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->reg_base), + "failed to get auxadc base address\n"); adc_dev->adc_clk = devm_clk_get_enabled(&pdev->dev, "main"); - if (IS_ERR(adc_dev->adc_clk)) { - dev_err(&pdev->dev, "failed to enable auxadc clock\n"); - return PTR_ERR(adc_dev->adc_clk); - } + if (IS_ERR(adc_dev->adc_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->adc_clk), + "failed to enable auxadc clock\n"); adc_clk_rate = clk_get_rate(adc_dev->adc_clk); - if (!adc_clk_rate) { - dev_err(&pdev->dev, "null clock rate\n"); - return -EINVAL; - } + if (!adc_clk_rate) + return dev_err_probe(&pdev->dev, -EINVAL, "null clock rate\n"); adc_dev->dev_comp = device_get_match_data(&pdev->dev); |