[PATCH v2 2/2] watchdog: imxwd: Add error messages for some failure points in .probe()

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Wed Jun 29 01:56:28 PDT 2022


Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
Hello,

as suggested by afa I'm using dev_err_probe() here now.

Best regards
Uwe

 drivers/watchdog/imxwd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index e9856c94c2fc..dba92cb46afb 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -245,11 +245,11 @@ static int imx_wd_probe(struct device_d *dev)
 
 	clk = clk_get(dev, NULL);
 	if (IS_ERR(clk))
-		return PTR_ERR(clk);
+		return dev_err_probe(dev, PTR_ERR(clk), "Failed to get clk\n");
 
 	ret = clk_enable(clk);
 	if (ret)
-		return ret;
+		return dev_err_probe(dev, ret, "Failed to enable clk\n");
 
 	priv->base = IOMEM(iores->start);
 	priv->ops = ops;
@@ -271,8 +271,10 @@ static int imx_wd_probe(struct device_d *dev)
 		}
 
 		ret = watchdog_register(&priv->wd);
-		if (ret)
+		if (ret) {
+			dev_err_probe(dev, ret, "Failed to register watchdog device\n");
 			goto on_error;
+		}
 	}
 
 	if (priv->ops->init) {
-- 
2.36.1




More information about the barebox mailing list