Skip to content

Commit 1e6c8fb

Browse files
Wolfram Sangrafaeljw
authored andcommitted
thermal: move from strlcpy() with unused retval to strscpy()
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 72c976f commit 1e6c8fb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
12191219
}
12201220

12211221
tz->id = id;
1222-
strlcpy(tz->type, type, sizeof(tz->type));
1222+
strscpy(tz->type, type, sizeof(tz->type));
12231223

12241224
result = dev_set_name(&tz->device, "thermal_zone%d", tz->id);
12251225
if (result)

drivers/thermal/thermal_hwmon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
147147
return -ENOMEM;
148148

149149
INIT_LIST_HEAD(&hwmon->tz_list);
150-
strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
150+
strscpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
151151
strreplace(hwmon->type, '-', '_');
152152
hwmon->device = hwmon_device_register_for_thermal(&tz->device,
153153
hwmon->type, hwmon);

0 commit comments

Comments
 (0)