From: Ovidiu Panait Date: Sat, 6 Jun 2026 21:04:19 +0000 (+0300) Subject: thermal: testing: Replace sscanf() with kstrtoint() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4f87cfcbae03498f0fd1689653cf84126196e14;p=thirdparty%2Flinux.git thermal: testing: Replace sscanf() with kstrtoint() Generally, kstrtoint() is preferred to sscanf() in kernel code, so replace the latter with the former in tt_del_tz() and tt_get_tt_zone(). Signed-off-by: Ovidiu Panait [ rjw: Changelog rewrite ] Link: https://patch.msgid.link/20260606210420.2311145-2-ovidiu.panait.oss@gmail.com Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c index 3c339242f52d..f7f9ca2f1f2c 100644 --- a/drivers/thermal/testing/zone.c +++ b/drivers/thermal/testing/zone.c @@ -239,9 +239,9 @@ int tt_del_tz(const char *arg) int ret; int id; - ret = sscanf(arg, "%d", &id); - if (ret != 1) - return -EINVAL; + ret = kstrtoint(arg, 10, &id); + if (ret < 0) + return ret; struct tt_work *tt_work __free(kfree) = kzalloc_obj(*tt_work); if (!tt_work) @@ -279,9 +279,9 @@ static struct tt_thermal_zone *tt_get_tt_zone(const char *arg) struct tt_thermal_zone *tt_zone; int ret, id; - ret = sscanf(arg, "%d", &id); - if (ret != 1) - return ERR_PTR(-EINVAL); + ret = kstrtoint(arg, 10, &id); + if (ret < 0) + return ERR_PTR(ret); guard(mutex)(&tt_thermal_zones_lock);