Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;