[PATCH 2/5] watchdog: bd96801_wdt: Set .owner = THIS_MODULE in watchdog_ops

From: Ian Rogers

Date: Mon Nov 30 2026 - 17:54:24 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 bd96801_wdt_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 09dad69757b6 ("watchdog: ROHM BD96801 PMIC WDG driver")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
drivers/watchdog/bd96801_wdt.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/bd96801_wdt.c b/drivers/watchdog/bd96801_wdt.c
index ce93a900b0be..38d14b22b09d 100644
--- a/drivers/watchdog/bd96801_wdt.c
+++ b/drivers/watchdog/bd96801_wdt.c
@@ -94,6 +94,7 @@ static const struct watchdog_info bd96801_wdt_info = {
};

static const struct watchdog_ops bd96801_wdt_ops = {
+ .owner = THIS_MODULE,
.start = bd96801_wdt_start,
.stop = bd96801_wdt_stop,
.ping = bd96801_wdt_ping,
--
2.56.1.839.g22a8290db9-goog