It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: 51f2cca1f72d ("hwmon/smsc47m1: Convert to a platform driver") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/hwmon/smsc47m1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 37531b5c8254..0dc432af7b18 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c @@ -719,6 +719,8 @@ static int __init smsc47m1_probe(struct platform_device *pdev) }; res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) + return -EINVAL; err = smsc47m1_handle_resources(res->start, sio_data->type, REQUEST, dev); if (err < 0) -- 2.25.1