Commit 8cbba23e authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Jonathan Cameron

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: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: default avatarJonathan Cameron <jic23@kernel.org>
Link: https://lore.kernel.org/r/20230826035402.3512033-2-ruanjinjie@huawei.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent b564b99d
...@@ -265,22 +265,18 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) ...@@ -265,22 +265,18 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels); indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels);
adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0); adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(adc_dev->reg_base)) { if (IS_ERR(adc_dev->reg_base))
dev_err(&pdev->dev, "failed to get auxadc base address\n"); return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->reg_base),
return PTR_ERR(adc_dev->reg_base); "failed to get auxadc base address\n");
}
adc_dev->adc_clk = devm_clk_get_enabled(&pdev->dev, "main"); adc_dev->adc_clk = devm_clk_get_enabled(&pdev->dev, "main");
if (IS_ERR(adc_dev->adc_clk)) { if (IS_ERR(adc_dev->adc_clk))
dev_err(&pdev->dev, "failed to enable auxadc clock\n"); return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->adc_clk),
return PTR_ERR(adc_dev->adc_clk); "failed to enable auxadc clock\n");
}
adc_clk_rate = clk_get_rate(adc_dev->adc_clk); adc_clk_rate = clk_get_rate(adc_dev->adc_clk);
if (!adc_clk_rate) { if (!adc_clk_rate)
dev_err(&pdev->dev, "null clock rate\n"); return dev_err_probe(&pdev->dev, -EINVAL, "null clock rate\n");
return -EINVAL;
}
adc_dev->dev_comp = device_get_match_data(&pdev->dev); adc_dev->dev_comp = device_get_match_data(&pdev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment