public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs()
@ 2023-03-18 14:44 Yangtao Li
  2023-03-18 14:44 ` [PATCH 2/9] thermal/drivers/sun8i: remove redundant msg in sun8i_ths_register() Yangtao Li
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Yangtao Li @ 2023-03-18 14:44 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui
  Cc: Yangtao Li, linux-pm, linux-kernel

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@vivo.com>
---
 drivers/thermal/thermal_hwmon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index c59db17dddd6..ae87401b1a1d 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -271,11 +271,15 @@ int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device
 
 	ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr),
 			   GFP_KERNEL);
-	if (!ptr)
+	if (!ptr) {
+		dev_err(dev, "Failed to allocate device resource data\n");
 		return -ENOMEM;
+	}
 
 	ret = thermal_add_hwmon_sysfs(tz);
 	if (ret) {
+		dev_err(dev, "Failed to add hwmon sysfs attributes\n");
+
 		devres_free(ptr);
 		return ret;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-05 12:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-18 14:44 [PATCH 1/9] thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs() Yangtao Li
2023-03-18 14:44 ` [PATCH 2/9] thermal/drivers/sun8i: remove redundant msg in sun8i_ths_register() Yangtao Li
2023-03-18 14:44 ` [PATCH 3/9] thermal/drivers/amlogic: remove redundant msg in amlogic_thermal_probe() Yangtao Li
2023-03-18 19:48   ` Martin Blumenstingl
2023-03-18 14:44 ` [PATCH 4/9] thermal/drivers/imx: remove redundant msg in imx8mm_tmu_probe() and imx_sc_thermal_probe() Yangtao Li
2023-03-18 14:44 ` [PATCH 5/9] drivers/thermal/k3: remove redundant msg in k3_bandgap_probe() Yangtao Li
2023-03-18 14:44 ` [PATCH 6/9] thermal/drivers/tegra: remove redundant msg in tegra_tsensor_register_channel() Yangtao Li
2023-04-05 12:13   ` Thierry Reding
2023-03-18 14:44 ` [PATCH 7/9] thermal/drivers/qoriq: remove redundant msg in qoriq_tmu_register_tmu_zone() Yangtao Li
2023-03-18 14:44 ` [PATCH 8/9] thermal/drivers/ti-soc: remove redundant msg in ti_thermal_expose_sensor() Yangtao Li
2023-03-18 14:44 ` [PATCH 9/9] thermal/drivers/qcom: remove redundant msg Yangtao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox