* [PATCH 5/5] watchdog: meson_gxbb_wdt: Set .owner = THIS_MODULE in watchdog_ops
[not found] <20261130225410.98349-1-irogers@google.com>
@ 2026-11-30 22:54 ` Ian Rogers
0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-11-30 22:54 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck
Cc: Nathan Chancellor, linux-watchdog, llvm, linux-kernel, Ian Rogers,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
linux-arm-kernel, linux-amlogic
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@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-30 22:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261130225410.98349-1-irogers@google.com>
2026-11-30 22:54 ` [PATCH 5/5] watchdog: meson_gxbb_wdt: Set .owner = THIS_MODULE in watchdog_ops Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox