diff options
author | 2017-01-31 03:56:08 -0800 | |
---|---|---|
committer | 2017-01-31 03:56:08 -0800 | |
commit | 319fe159889a06b47a2621a1201c813502b7a842 (patch) | |
tree | f704f481f2e8c3787664553fd24332c8311273a4 /drivers/hwmon/hwmon.c | |
parent | hwmon: Relax name attribute validation for new APIs (diff) | |
download | linux-319fe159889a06b47a2621a1201c813502b7a842.tar.gz linux-319fe159889a06b47a2621a1201c813502b7a842.tar.bz2 linux-319fe159889a06b47a2621a1201c813502b7a842.zip |
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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/hwmon.c')
-rw-r--r-- | drivers/hwmon/hwmon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 9a02c452f9e5..28375d59cc36 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -608,7 +608,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, if (err) goto free_hwmon; - if (chip && chip->ops->read && + if (dev && chip && chip->ops->read && chip->info[0]->type == hwmon_chip && (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) { const struct hwmon_channel_info **info = chip->info; |