public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Xichao Zhao <zhao.xichao@vivo.com>
Cc: "Jean Delvare" <jdelvare@suse.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	"Lukasz Luba" <lukasz.luba@arm.com>,
	"Guillaume La Roque" <glaroque@baylibre.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Ray Jui" <rjui@broadcom.com>,
	"Scott Branden" <sbranden@broadcom.com>,
	"Markus Mayer" <mmayer@broadcom.com>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	zhanghongchen <zhanghongchen@loongson.cn>,
	"Yinbo Zhu" <zhuyinbo@loongson.cn>,
	"Amit Kucheria" <amitk@kernel.org>,
	"Thara Gopinath" <thara.gopinath@gmail.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Bartlomiej Zolnierkiewicz" <bzolnier@gmail.com>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Orson Zhai" <orsonzhai@gmail.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Chunyan Zhang" <zhang.lyra@gmail.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Talel Shenhar" <talel@amazon.com>,
	"Eduardo Valentin" <edubezval@gmail.com>,
	Keerthy <j-keerthy@ti.com>,
	"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"open list:HARDWARE MONITORING" <linux-hwmon@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@vger.kernel.org>,
	"moderated list:ARM/Allwinner sunXi SoC support"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Allwinner sunXi SoC support"
	<linux-sunxi@lists.linux.dev>,
	"open list:THERMAL" <linux-pm@vger.kernel.org>,
	"open list:THERMAL DRIVER FOR AMLOGIC SOCS"
	<linux-amlogic@lists.infradead.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	"open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
	<imx@lists.linux.dev>,
	"open list:QUALCOMM TSENS THERMAL DRIVER"
	<linux-arm-msm@vger.kernel.org>,
	"open list:RENESAS R-CAR THERMAL DRIVERS"
	<linux-renesas-soc@vger.kernel.org>,
	"open list:ARM/Rockchip SoC support"
	<linux-rockchip@lists.infradead.org>,
	"open list:SAMSUNG THERMAL DRIVER"
	<linux-samsung-soc@vger.kernel.org>,
	"moderated list:ARM/STM32 ARCHITECTURE"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"open list:TEGRA ARCHITECTURE SUPPORT"
	<linux-tegra@vger.kernel.org>,
	"open list:TI BANDGAP AND THERMAL DRIVER"
	<linux-omap@vger.kernel.org>
Subject: Re: [PATCH 01/12] thermal: of: Add error handling in devm_thermal_*_register()
Date: Fri, 5 Sep 2025 09:56:25 +0200	[thread overview]
Message-ID: <20250905075625.GA1852264@ragnatech.se> (raw)
In-Reply-To: <20250905072423.368123-2-zhao.xichao@vivo.com>

Hello Xichao,

Thanks for your work.

On 2025-09-05 15:23:53 +0800, Xichao Zhao wrote:
> devm_thermal_of_zone_register() does not print any error message
> when registering a thermal zone with a device node sensor fails
> and allocating device resource data fails.
> 
> This forces each driver to implement redundant error logging.
> Additionally, when upper-layer functions propagate these errors
> without logging, critical debugging information is lost.
> 
> Add dev_err_probe() in devm_thermal_of_zone_register() to unify
> error reporting.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  drivers/thermal/thermal_of.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 1a51a4d240ff..8fe0ad402579 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -475,11 +475,15 @@ 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_probe(dev, PTR_ERR(tzd),
> +			      "Failed to register thermal zone sensor[%d]\n", sensor_id);

Don't thermal_of_zone_register() already print an error message for 
failure cases? If not can this print be moved there? That would allow 
the change you make in R-Car drivers to remove the prating completely, 
not just for the devm_* cases.

>  		devres_free(ptr);
>  		return tzd;
>  	}
> -- 
> 2.34.1
> 

-- 
Kind Regards,
Niklas Söderlund

  reply	other threads:[~2025-09-05  7:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05  7:23 [PATCH 00/12] drivers: Integrate log message printing into devm_thermal_*_register() Xichao Zhao
2025-09-05  7:23 ` [PATCH 01/12] thermal: of: Add error handling in devm_thermal_*_register() Xichao Zhao
2025-09-05  7:56   ` Niklas Söderlund [this message]
2025-09-05  9:33   ` Andy Shevchenko
2025-09-05  9:35     ` Andy Shevchenko
2025-09-05 14:28   ` Guenter Roeck
2025-09-05  7:23 ` [PATCH 02/12] hwmon: Remove redundant error log prints Xichao Zhao
2025-09-05 14:31   ` Guenter Roeck
2025-09-05  7:23 ` [PATCH 03/12] iio: adc: " Xichao Zhao
2025-09-05  7:37   ` Chen-Yu Tsai
2025-09-05  7:23 ` [PATCH 04/12] regulator: max8973: " Xichao Zhao
2025-09-05 10:42   ` Mark Brown
2025-09-05  7:23 ` [PATCH 05/12] thermal: " Xichao Zhao
2025-09-05  7:23 ` [PATCH 06/12] thermal: broadcom: " Xichao Zhao
2025-09-05  7:23 ` [PATCH 07/12] thermal: qcom: " Xichao Zhao
2025-09-05  7:24 ` [PATCH 08/12] thermal: renesas: " Xichao Zhao
2025-09-05  7:24 ` [PATCH 09/12] thermal: samsung: " Xichao Zhao
2025-09-05  7:24 ` [PATCH 10/12] thermal: st: " Xichao Zhao
2025-09-05  7:24 ` [PATCH 11/12] thermal: tegra: " Xichao Zhao
2025-09-05  7:24 ` [PATCH 12/12] thermal: ti-soc-thermal: " Xichao Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250905075625.GA1852264@ragnatech.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alim.akhtar@samsung.com \
    --cc=amitk@kernel.org \
    --cc=andy@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=broonie@kernel.org \
    --cc=bzolnier@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=dlechner@baylibre.com \
    --cc=edubezval@gmail.com \
    --cc=festevam@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=geert+renesas@glider.be \
    --cc=glaroque@baylibre.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=heiko@sntech.de \
    --cc=imx@lists.linux.dev \
    --cc=j-keerthy@ti.com \
    --cc=jdelvare@suse.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lukasz.luba@arm.com \
    --cc=magnus.damm@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mmayer@broadcom.com \
    --cc=nuno.sa@analog.com \
    --cc=orsonzhai@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rjui@broadcom.com \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=samuel@sholland.org \
    --cc=sbranden@broadcom.com \
    --cc=shawnguo@kernel.org \
    --cc=talel@amazon.com \
    --cc=thara.gopinath@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=wens@csie.org \
    --cc=zhang.lyra@gmail.com \
    --cc=zhanghongchen@loongson.cn \
    --cc=zhao.xichao@vivo.com \
    --cc=zhuyinbo@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox