Commit 319fe159 authored by Guenter Roeck's avatar Guenter Roeck

hwmon: Register thermal zone only if 'dev' parameter was provided

Rgistering a thermal zone uses devm_kzalloc(), which requires
a pointer to the parent device.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 74d3b641
...@@ -608,7 +608,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, ...@@ -608,7 +608,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
if (err) if (err)
goto free_hwmon; goto free_hwmon;
if (chip && chip->ops->read && if (dev && chip && chip->ops->read &&
chip->info[0]->type == hwmon_chip && chip->info[0]->type == hwmon_chip &&
(chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) { (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) {
const struct hwmon_channel_info **info = chip->info; const struct hwmon_channel_info **info = chip->info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment