]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (gpd-fan) Fix return value when platform_get_resource() fails
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Fri, 10 Oct 2025 20:43:59 +0000 (13:43 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 20 Oct 2025 01:56:14 +0000 (18:56 -0700)
When platform_get_resource() fails it returns NULL and not an error
pointer, accordingly change the error handling.

Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20251010204359.94300-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/gpd-fan.c

index 644dc3ca9df7da0174e513c47a820a6ff39eb0ef..eebe39ef967775238e8ff5a2a4d223f2ee3e1339 100644 (file)
@@ -615,8 +615,8 @@ static int gpd_fan_probe(struct platform_device *pdev)
        const struct device *hwdev;
 
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
-       if (IS_ERR(res))
-               return dev_err_probe(dev, PTR_ERR(res),
+       if (!res)
+               return dev_err_probe(dev, -EINVAL,
                                     "Failed to get platform resource\n");
 
        region = devm_request_region(dev, res->start,