mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 10:31:33 -04:00
iio: adc: exynos: Simplify with dev_err_probe
Use dev_err_probe() to make error code handling simpler and handle deferred probe nicely (avoid spamming logs). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
dcc3ac29f4
commit
0dce3f98a7
@@ -564,10 +564,8 @@ static int exynos_adc_probe(struct platform_device *pdev)
|
||||
info = iio_priv(indio_dev);
|
||||
|
||||
info->data = exynos_adc_get_data(pdev);
|
||||
if (!info->data) {
|
||||
dev_err(&pdev->dev, "failed getting exynos_adc_data\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!info->data)
|
||||
return dev_err_probe(&pdev->dev, -EINVAL, "failed getting exynos_adc_data\n");
|
||||
|
||||
info->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(info->regs))
|
||||
@@ -578,10 +576,9 @@ static int exynos_adc_probe(struct platform_device *pdev)
|
||||
info->pmu_map = syscon_regmap_lookup_by_phandle(
|
||||
pdev->dev.of_node,
|
||||
"samsung,syscon-phandle");
|
||||
if (IS_ERR(info->pmu_map)) {
|
||||
dev_err(&pdev->dev, "syscon regmap lookup failed.\n");
|
||||
return PTR_ERR(info->pmu_map);
|
||||
}
|
||||
if (IS_ERR(info->pmu_map))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(info->pmu_map),
|
||||
"syscon regmap lookup failed.\n");
|
||||
}
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
@@ -593,20 +590,14 @@ static int exynos_adc_probe(struct platform_device *pdev)
|
||||
init_completion(&info->completion);
|
||||
|
||||
info->clk = devm_clk_get(&pdev->dev, "adc");
|
||||
if (IS_ERR(info->clk)) {
|
||||
dev_err(&pdev->dev, "failed getting clock, err = %ld\n",
|
||||
PTR_ERR(info->clk));
|
||||
return PTR_ERR(info->clk);
|
||||
}
|
||||
if (IS_ERR(info->clk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), "failed getting clock\n");
|
||||
|
||||
if (info->data->needs_sclk) {
|
||||
info->sclk = devm_clk_get(&pdev->dev, "sclk");
|
||||
if (IS_ERR(info->sclk)) {
|
||||
dev_err(&pdev->dev,
|
||||
"failed getting sclk clock, err = %ld\n",
|
||||
PTR_ERR(info->sclk));
|
||||
return PTR_ERR(info->sclk);
|
||||
}
|
||||
if (IS_ERR(info->sclk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(info->sclk),
|
||||
"failed getting sclk clock\n");
|
||||
}
|
||||
|
||||
info->vdd = devm_regulator_get(&pdev->dev, "vdd");
|
||||
|
||||
Reference in New Issue
Block a user