Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jinjie Ruan and committed by
Jonathan Cameron
8cbba23e b564b99d

+8 -12
+8 -12
drivers/iio/adc/mt6577_auxadc.c
··· 265 265 indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels); 266 266 267 267 adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0); 268 - if (IS_ERR(adc_dev->reg_base)) { 269 - dev_err(&pdev->dev, "failed to get auxadc base address\n"); 270 - return PTR_ERR(adc_dev->reg_base); 271 - } 268 + if (IS_ERR(adc_dev->reg_base)) 269 + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->reg_base), 270 + "failed to get auxadc base address\n"); 272 271 273 272 adc_dev->adc_clk = devm_clk_get_enabled(&pdev->dev, "main"); 274 - if (IS_ERR(adc_dev->adc_clk)) { 275 - dev_err(&pdev->dev, "failed to enable auxadc clock\n"); 276 - return PTR_ERR(adc_dev->adc_clk); 277 - } 273 + if (IS_ERR(adc_dev->adc_clk)) 274 + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->adc_clk), 275 + "failed to enable auxadc clock\n"); 278 276 279 277 adc_clk_rate = clk_get_rate(adc_dev->adc_clk); 280 - if (!adc_clk_rate) { 281 - dev_err(&pdev->dev, "null clock rate\n"); 282 - return -EINVAL; 283 - } 278 + if (!adc_clk_rate) 279 + return dev_err_probe(&pdev->dev, -EINVAL, "null clock rate\n"); 284 280 285 281 adc_dev->dev_comp = device_get_match_data(&pdev->dev); 286 282