Thread (26 messages) 26 messages, 5 authors, 2024-01-30

Re: [PATCH 03/10] watchdog: rzg2l_wdt: Check return status of pm_runtime_put()

From: Guenter Roeck <linux@roeck-us.net>
Date: 2024-01-22 17:32:02
Also in: linux-clk, linux-renesas-soc, linux-watchdog, lkml

On 1/22/24 03:11, Claudiu wrote:
quoted hunk ↗ jump to hunk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

pm_runtime_put() may return an error code. Check its return status.

Fixes: 2cbc5cd0b55f ("watchdog: Add Watchdog Timer driver for RZ/G2L")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
  drivers/watchdog/rzg2l_wdt.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
index 4ab9e7c5e771..0554965027cd 100644
--- a/drivers/watchdog/rzg2l_wdt.c
+++ b/drivers/watchdog/rzg2l_wdt.c
@@ -144,9 +144,13 @@ static int rzg2l_wdt_start(struct watchdog_device *wdev)
  static int rzg2l_wdt_stop(struct watchdog_device *wdev)
  {
  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
+	int ret;
  
  	rzg2l_wdt_reset(priv);
-	pm_runtime_put(wdev->parent);
+
+	ret = pm_runtime_put(wdev->parent);
+	if (ret < 0)
+		return ret;
  
  	return 0;
  }
A simple
	return pm_runtime_put();
might do.

However, one question: Given that pm_runtime_put() returns -ENOSYS if
CONFIG_PM is disabled, that means the driver will depend on CONFIG_PM=y.
Assuming this is intentional, would it make sense to explicitly declare
that dependency in Kconfig ? It doesn't seem to make any sense to build
the driver if it won't work anyway.

Thanks,
Guenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help