summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2018-07-10 16:40:34 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-19 22:41:34 +0200
commite66813955581f2aa0aff076c12ac4313ab99c020 (patch)
treec521a89e274f257ad4c38bf1ce3515aa8052c43e
parent8cc36414d8158e68d3bcb56f0ce2396152eac848 (diff)
downloadlinux-stable-e66813955581f2aa0aff076c12ac4313ab99c020.tar.gz
linux-stable-e66813955581f2aa0aff076c12ac4313ab99c020.tar.bz2
linux-stable-e66813955581f2aa0aff076c12ac4313ab99c020.zip
thermal_hwmon: Sanitize attribute name passed to hwmon
[ Upstream commit 409ef0bacacf72c51cc876349ae3fdf7cf726d47 ] 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 b92fe9e3379c8. 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> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/thermal/thermal_hwmon.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index 11278836ed12..0bd47007c57f 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -142,6 +142,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
INIT_LIST_HEAD(&hwmon->tz_list);
strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
+ strreplace(hwmon->type, '-', '_');
hwmon->device = hwmon_device_register_with_info(NULL, hwmon->type,
hwmon, NULL, NULL);
if (IS_ERR(hwmon->device)) {