power: supply: cpcap: Simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzk@kernel.org>
Wed, 26 Aug 2020 14:48:55 +0000 (16:48 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 26 Aug 2020 15:25:42 +0000 (17:25 +0200)
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>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/cpcap-battery.c

index 90eba36..295611b 100644 (file)
@@ -747,11 +747,8 @@ static int cpcap_battery_init_iio(struct cpcap_battery_ddata *ddata)
        return 0;
 
 out_err:
-       if (error != -EPROBE_DEFER)
-               dev_err(ddata->dev, "could not initialize VBUS or ID IIO: %i\n",
-                       error);
-
-       return error;
+       return dev_err_probe(ddata->dev, error,
+                            "could not initialize VBUS or ID IIO\n");
 }
 
 /* Calibrate coulomb counter */