Skip to contentSkip to conversation

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

PATCH New Guenter Roeck 1 participant 1 message Jan 31, 2017 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 drivers/hwmon/hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/hwmon.c +1 -1
index 9a02c452f9e5..28375d59cc36 100644
@@ -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;
Signature · 1 line
2.7.4