hwmon: Fix possible NULL pointer
authorPaul Cercueil <paul@crapouillou.net>
Mon, 31 Jan 2022 16:27:40 +0000 (16:27 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 5 Feb 2022 18:01:34 +0000 (10:01 -0800)
commitd7b5273204f5627392220ff2d671a61bc92a22d4
treec703cc61b39a8639bc75d86ec6bc2831abf6ed88
parentc8fefd8725698935cd5e2e2320551942a017d73c
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>
drivers/hwmon/hwmon.c