[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6e8b64f1-a285-227c-c335-c0dd0e683b50@linaro.org>
Date: Thu, 13 Jul 2023 15:00:18 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Yangtao Li <frank.li@...o.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Amit Kucheria <amitk@...nel.org>,
Zhang Rui <rui.zhang@...el.com>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] thermal/of: Add error information printing for
devm_thermal_of_zone_register()
On 11/07/2023 14:45, Yangtao Li wrote:
> Ensure that all error handling branches print error information. In this
> way, when this function fails, the upper-layer functions can directly
> return an error code without missing debugging information. Otherwise,
> the error message will be printed redundantly or missing.
>
> Signed-off-by: Yangtao Li <frank.li@...o.com>
> ---
> drivers/thermal/thermal_of.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 6fb14e521197..8ce231f7639a 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -583,11 +583,14 @@ struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, in
>
> ptr = devres_alloc(devm_thermal_of_zone_release, sizeof(*ptr),
> GFP_KERNEL);
> - if (!ptr)
> + if (!ptr) {
> + dev_err(dev, "Failed to allocate device resource data\n");
> return ERR_PTR(-ENOMEM);
> + }
>
> tzd = thermal_of_zone_register(dev->of_node, sensor_id, data, ops);
> if (IS_ERR(tzd)) {
> + dev_err(dev, "Failed to register thermal zone: %d\n", PTR_ERR(tzd));
Not sure if having this error is useful as we already have an error
showing up with the thermal_of_zone_register() function
> devres_free(ptr);
> return tzd;
> }
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Powered by blists - more mailing lists