Skip to content

Commit 409ef0b

Browse files
Marc ZyngierEduardo Valentin
authored andcommitted
thermal_hwmon: Sanitize attribute name passed to hwmon
My Chromebook Plus (kevin) is spitting the following at boot time: (NULL device *): hwmon: 'sbs-9-000b' is not a valid name attribute, please fix Clearly, __hwmon_device_register is unhappy about the property name. Some investigation reveals that thermal_add_hwmon_sysfs doesn't sanitize the name of the attribute. In order to keep it quiet, let's replace '-' with '_' in hwmon->type This is consistent with what iio-hwmon does since b92fe9e. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
1 parent 59d7f4a commit 409ef0b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/thermal/thermal_hwmon.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
142142

143143
INIT_LIST_HEAD(&hwmon->tz_list);
144144
strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
145+
strreplace(hwmon->type, '-', '_');
145146
hwmon->device = hwmon_device_register_with_info(NULL, hwmon->type,
146147
hwmon, NULL, NULL);
147148
if (IS_ERR(hwmon->device)) {

0 commit comments

Comments
 (0)