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

From: Guenter Roeck
Date: Mon Jan 22 2024 - 13:07:58 EST


On 1/22/24 03:11, Claudiu wrote:
From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
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