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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 9 Aug 2022 07:25:55 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>, rafael@...nel.org
Cc:     michael@...le.cc, dan.carpenter@...cle.com,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>
Subject: Re: [PATCH v2 2/4] thermal/of: Return -ENODEV instead of -EINVAL if
 registration fails

On 8/9/22 01:56, Daniel Lezcano wrote:
> The previous version of the OF code was returning -ENODEV if no
> thermal zones description was found or if the lookup of the sensor in
> the thermal zones was not found.
> 
> The backend drivers are expecting this return value as an information
> about skipping the sensor initialization and considered as normal.
> 
> Fix the return value by replacing -EINVAL by -ENODEV and remove the
> error message as this missing is not considered as an error.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> Tested-by: Michael Walle <michael@...le.cc>

Reviewed-by: Guenter Roeck <linux@...ck-us.net>

> ---
>    v2:
>     - Change the error message to a debug message
>     - Only show an error if the error is not -ENODEV
> ---
>   drivers/thermal/thermal_of.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 368eb58e97cf..3effc729be4b 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -328,8 +328,8 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
>   
>   	np = of_find_node_by_name(NULL, "thermal-zones");
>   	if (!np) {
> -		pr_err("Unable to find thermal zones description\n");
> -		return ERR_PTR(-EINVAL);
> +		pr_debug("No thermal zones description\n");
> +		return ERR_PTR(-ENODEV);
>   	}
>   
>   	/*
> @@ -368,7 +368,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
>   			}
>   		}
>   	}
> -	tz = ERR_PTR(-EINVAL);
> +	tz = ERR_PTR(-ENODEV);
>   out:
>   	of_node_put(np);
>   	return tz;
> @@ -642,7 +642,8 @@ struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor,
>   
>   	np = of_thermal_zone_find(sensor, id);
>   	if (IS_ERR(np)) {
> -		pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
> +		if (PTR_ERR(np) != -ENODEV)
> +			pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
>   		return ERR_CAST(np);
>   	}
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ