Skip to content

Commit 8416ecf

Browse files
bbkzzdlezcano
authored andcommitted
thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs()
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 <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2ef9533 commit 8416ecf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/thermal/thermal_hwmon.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,14 @@ int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device
271271

272272
ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr),
273273
GFP_KERNEL);
274-
if (!ptr)
274+
if (!ptr) {
275+
dev_warn(dev, "Failed to allocate device resource data\n");
275276
return -ENOMEM;
277+
}
276278

277279
ret = thermal_add_hwmon_sysfs(tz);
278280
if (ret) {
281+
dev_warn(dev, "Failed to add hwmon sysfs attributes\n");
279282
devres_free(ptr);
280283
return ret;
281284
}

0 commit comments

Comments
 (0)