thermal_hwmon: Sanitize thermal_zone type
authorStefan Mavrodiev <stefan@olimex.com>
Fri, 26 Jul 2019 13:32:36 +0000 (16:32 +0300)
committerZhang Rui <rui.zhang@intel.com>
Tue, 24 Sep 2019 01:56:08 +0000 (09:56 +0800)
commit8c7aa184281c01fc26f319059efb94725012921d
tree5124298e324c06994913dcbc3dafa1a1255bb66e
parentd1abaeb3be7b5fa6d7a1fbbd2e14e3310005c4c1
thermal_hwmon: Sanitize thermal_zone type

When calling thermal_add_hwmon_sysfs(), the device type is sanitized by
replacing '-' with '_'. However tz->type remains unsanitized. Thus
calling thermal_hwmon_lookup_by_type() returns no device. And if there is
no device, thermal_remove_hwmon_sysfs() fails with "hwmon device lookup
failed!".

The result is unregisted hwmon devices in the sysfs.

Fixes: 409ef0bacacf ("thermal_hwmon: Sanitize attribute name passed to hwmon")

Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/thermal_hwmon.c