Skip to content

Commit 72ac148

Browse files
harshimogalapalligroeck
authored andcommitted
hwmon: (gpd-fan) Fix error handling in gpd_fan_probe()
devm_request_region() returns a NULL pointer on error, not an ERR_PTR(). Handle it accordingly. Also fix error return from the call to devm_hwmon_device_register_with_info(). Fixes: 0ab88e2 ("hwmon: add GPD devices sensor driver") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Reviewed-by: Cryolitia PukNgae <cryolitia@uniontech.com> Link: https://lore.kernel.org/r/20251010204447.94343-1-harshit.m.mogalapalli@oracle.com [groeck: Updated subject to improve readability] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent ab0fd09 commit 72ac148

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/hwmon/gpd-fan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ static int gpd_fan_probe(struct platform_device *pdev)
621621

622622
region = devm_request_region(dev, res->start,
623623
resource_size(res), DRIVER_NAME);
624-
if (IS_ERR(region))
625-
return dev_err_probe(dev, PTR_ERR(region),
624+
if (!region)
625+
return dev_err_probe(dev, -EBUSY,
626626
"Failed to request region\n");
627627

628628
hwdev = devm_hwmon_device_register_with_info(dev,
@@ -631,7 +631,7 @@ static int gpd_fan_probe(struct platform_device *pdev)
631631
&gpd_fan_chip_info,
632632
NULL);
633633
if (IS_ERR(hwdev))
634-
return dev_err_probe(dev, PTR_ERR(region),
634+
return dev_err_probe(dev, PTR_ERR(hwdev),
635635
"Failed to register hwmon device\n");
636636

637637
return 0;

0 commit comments

Comments
 (0)