mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
hwmon: Fix possible NULL pointer
The recent addition of the label attribute added some code that read the
"label" device property, without checking first that "dev" was non-NULL.
Fix this issue by first checking that "dev" is non-NULL.
Fixes: ccd98cba6a18 ("hwmon: Add "label" attribute")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
committed by
Guenter Roeck
parent
9f93aa1005
commit
07320c9156
@@ -809,7 +809,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
|
||||
hdev->groups = groups;
|
||||
}
|
||||
|
||||
if (device_property_present(dev, "label")) {
|
||||
if (dev && device_property_present(dev, "label")) {
|
||||
err = device_property_read_string(dev, "label", &label);
|
||||
if (err < 0)
|
||||
goto free_hwmon;
|
||||
|
||||
Reference in New Issue
Block a user