[PATCH v3 2/2] watchdog: use kstrtouint to parse softlockup_panic=

From: 林濬哲

Date: Tue Sep 22 2026 - 11:00:27 EST



simple_strtoul() is deprecated. Use kstrtouint() instead; on a parse
error the variable is now left unchanged instead of being silently
clamped.

__setup() handlers return whether they handled the option and cannot
propagate parse errors, so the handler simply returns 1.

v3: do not warn on parse errors (Guenter Roeck).

Signed-off-by: Lin Junzhe <m18667909625@xxxxxxx>
Assisted-by: AI coding assistant (per kernel AI guidelines)
---
kernel/watchdog.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 420f08140713..69cd5ebb4929 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -423,10 +423,11 @@ static unsigned long soft_lockup_nmi_warn;

static int __init softlockup_panic_setup(char *str)
{
- int ret;
+ unsigned int val;

- ret = kstrtouint(str, 0, &softlockup_panic);
- return ret ? ret : 1;
+ if (!kstrtouint(str, 0, &val))
+ softlockup_panic = val;
+ return 1;
}
__setup("softlockup_panic=", softlockup_panic_setup);

--
2.54.0.windows.1