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 <ovidiu.panait.oss@gmail.com>
[ rjw: Changelog rewrite ]
Link: https://patch.msgid.link/20260606210420.2311145-2-ovidiu.panait.oss@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Ovidiu Panait
2026-06-07 00:04:19 +03:00
committed by Rafael J. Wysocki
parent ef3e98b0aa
commit e4f87cfcba

View File

@@ -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);