iio: adc: exynos_adc: Simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzk@kernel.org>
Sat, 29 Aug 2020 06:47:12 +0000 (08:47 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Sep 2020 18:40:49 +0000 (19:40 +0100)
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-4-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/exynos_adc.c

index 7d23b6c3328414d12a7b708d171cbbf772311311..20477b249f2abe5c04b905e24f21b9bd97b2d44e 100644 (file)
@@ -844,13 +844,9 @@ static int exynos_adc_probe(struct platform_device *pdev)
        }
 
        info->vdd = devm_regulator_get(&pdev->dev, "vdd");
-       if (IS_ERR(info->vdd)) {
-               if (PTR_ERR(info->vdd) != -EPROBE_DEFER)
-                       dev_err(&pdev->dev,
-                               "failed getting regulator, err = %ld\n",
-                               PTR_ERR(info->vdd));
-               return PTR_ERR(info->vdd);
-       }
+       if (IS_ERR(info->vdd))
+               return dev_err_probe(&pdev->dev, PTR_ERR(info->vdd),
+                                    "failed getting regulator");
 
        ret = regulator_enable(info->vdd);
        if (ret)