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

Ian Rogers irogers at google.com
Mon Nov 30 14:54:09 PST 2026


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 meson_gxbb_wdt_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 683fa50f0e18 ("watchdog: Add Meson GXBB Watchdog Driver")
Signed-off-by: Ian Rogers <irogers at google.com>
---
 drivers/watchdog/meson_gxbb_wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
index a88fe8cbeef5..7ee8632eba36 100644
--- a/drivers/watchdog/meson_gxbb_wdt.c
+++ b/drivers/watchdog/meson_gxbb_wdt.c
@@ -108,6 +108,7 @@ static unsigned int meson_gxbb_wdt_get_timeleft(struct watchdog_device *wdt_dev)
 }
 
 static const struct watchdog_ops meson_gxbb_wdt_ops = {
+	.owner = THIS_MODULE,
 	.start = meson_gxbb_wdt_start,
 	.stop = meson_gxbb_wdt_stop,
 	.ping = meson_gxbb_wdt_ping,
-- 
2.56.1.839.g22a8290db9-goog




More information about the linux-arm-kernel mailing list