提交 319fe159 编写于 作者: G 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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 74d3b641
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册