[PATCH 4/5] watchdog: max77620: Set .owner = THIS_MODULE in watchdog_ops

From: Ian Rogers

Date: Mon Nov 30 2026 - 17:54:28 EST


watchdog_open() calls try_module_get(wdd->ops->owner) to prevent the
watchdog driver module from being unloaded while /dev/watchdog is open,
and watchdog_release() calls module_put(wdd->ops->owner). Because
try_module_get(NULL) succeeds without incrementing any module reference
count, omitting .owner = THIS_MODULE allows the module to be unloaded
while the watchdog character device is open.

Set .owner = THIS_MODULE in max77620_wdt_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: ff3bb2f5c3cd ("watchdog: max77620: Add support for watchdog timer")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
drivers/watchdog/max77620_wdt.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/max77620_wdt.c b/drivers/watchdog/max77620_wdt.c
index 4fc8a858d221..ad2b497f7c9a 100644
--- a/drivers/watchdog/max77620_wdt.c
+++ b/drivers/watchdog/max77620_wdt.c
@@ -148,6 +148,7 @@ static const struct watchdog_info max77620_wdt_info = {
};

static const struct watchdog_ops max77620_wdt_ops = {
+ .owner = THIS_MODULE,
.start = max77620_wdt_start,
.stop = max77620_wdt_stop,
.ping = max77620_wdt_ping,
--
2.56.1.839.g22a8290db9-goog