It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: 787c72b10788 ("hwmon/w83627hf: Convert to a platform driver") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/hwmon/w83627hf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 9be277156ed2..9d370d73d39d 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -1407,6 +1407,8 @@ static int w83627hf_probe(struct platform_device *pdev) }; res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) + return -EINVAL; if (!devm_request_region(dev, res->start, WINB_REGION_SIZE, DRVNAME)) { dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", (unsigned long)res->start, -- 2.25.1