Commit 72ac1485 authored by Harshit Mogalapalli's avatar Harshit Mogalapalli Committed by Guenter Roeck
Browse files

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: 0ab88e23 ("hwmon: add GPD devices sensor driver")
Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: default avatarCryolitia 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: default avatarGuenter Roeck <linux@roeck-us.net>
parent ab0fd09d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -621,8 +621,8 @@ static int gpd_fan_probe(struct platform_device *pdev)

	region = devm_request_region(dev, res->start,
				     resource_size(res), DRIVER_NAME);
	if (IS_ERR(region))
		return dev_err_probe(dev, PTR_ERR(region),
	if (!region)
		return dev_err_probe(dev, -EBUSY,
				     "Failed to request region\n");

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

	return 0;