diff mbox series

[9/9] i2c: mux: reg: Simplify with dev_err_probe()

Message ID 20200902150643.14839-9-krzk@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/9] i2c: stm32: Simplify with dev_err_probe() | expand

Commit Message

Krzysztof Kozlowski Sept. 2, 2020, 3:06 p.m. UTC
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/i2c/muxes/i2c-mux-reg.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Peter Rosin Sept. 2, 2020, 6:33 p.m. UTC | #1
On 2020-09-02 17:06, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Acked-by: Peter Rosin <peda@axentia.se>

Cheers,
Peter
Wolfram Sang Sept. 10, 2020, 6:24 a.m. UTC | #2
On Wed, Sep 02, 2020 at 05:06:43PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
index b59a62f8d7a6..0e0679f65cf7 100644
--- a/drivers/i2c/muxes/i2c-mux-reg.c
+++ b/drivers/i2c/muxes/i2c-mux-reg.c
@@ -171,13 +171,9 @@  static int i2c_mux_reg_probe(struct platform_device *pdev)
 			sizeof(mux->data));
 	} else {
 		ret = i2c_mux_reg_probe_dt(mux, pdev);
-		if (ret == -EPROBE_DEFER)
-			return ret;
-
-		if (ret < 0) {
-			dev_err(&pdev->dev, "Error parsing device tree");
-			return ret;
-		}
+		if (ret < 0)
+			return dev_err_probe(&pdev->dev, ret,
+					     "Error parsing device tree");
 	}
 
 	parent = i2c_get_adapter(mux->data.parent);