lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5765996267362A79+7284a202-923d-4b02-99c0-b2a6edb01082@uniontech.com>
Date: Sat, 11 Oct 2025 14:16:30 +0800
From: Cryolitia PukNgae <cryolitia@...ontech.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
 Guenter Roeck <linux@...ck-us.net>, linux-hwmon@...r.kernel.org,
 linux-kernel@...r.kernel.org, cryolitia.pukngae@...ux.dev
Cc: dan.carpenter@...aro.org, kernel-janitors@...r.kernel.org,
 error27@...il.com
Subject: Re: [PATCH] hwmon: gpd-fan: Fix error handling in gpd_fan_probe()

On 11/10/2025 04.44, Harshit Mogalapalli wrote:
> When devm_request_region(0 fails to get a region regrion would be NULL
> and devm_hwmon_device_register_with_info() fails, best to propagate
> the hwmon dev to PTR_ERR() as opposed to region.
> 
> Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
> ---
> This is based on static analysis with Smatch, only compile tested.
> ---
>  drivers/hwmon/gpd-fan.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
> index eebe39ef9677..321794807e8d 100644
> --- a/drivers/hwmon/gpd-fan.c
> +++ b/drivers/hwmon/gpd-fan.c
> @@ -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;

Reviewed-by: Cryolitia PukNgae <cryolitia@...ontech.com>

thx

Best regards
Cryolitia PukNgae



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ