mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 16:17:32 -04:00
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:
committed by
Rafael J. Wysocki
parent
ef3e98b0aa
commit
e4f87cfcba
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user