[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250805125003.12573-3-artyom.shimko@gmail.com>
Date: Tue, 5 Aug 2025 15:43:58 +0300
From: "a.shimko" <artyom.shimko@...il.com>
To: linux-hwmon@...r.kernel.org
Cc: "a.shimko" <artyom.shimko@...il.com>,
linux-kernel@...r.kernel.org,
sudeep.holla@....com,
cristian.marussi@....com,
jdelvare@...e.com,
guenter.roeck@...ux.com
Subject: [PATCH 2/3] hwmon: scmi: Remove redundant devm_kfree call
From: Artem Shimko <artyom.shimko@...il.com>
Fix potential resource management issue by:
- Removing unnecessary devm_kfree() call in error path
- Relying on devres automatic cleanup
- Preserving all error handling logic
Rationale:
- Memory was allocated with devm_kzalloc()
- devm_ thermal registration manages its own resources
- Double-free could occur during probe failure
Signed-off-by: Artem Shimko <artyom.shimko@...il.com>
---
drivers/hwmon/scmi-hwmon.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index a3b5b5c0ec25..d03174922e65 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -211,8 +211,6 @@ static int scmi_thermal_sensor_register(struct device *dev,
tzd = devm_thermal_of_zone_register(dev, th_sensor->info->id, th_sensor,
&scmi_hwmon_thermal_ops);
if (IS_ERR(tzd)) {
- devm_kfree(dev, th_sensor);
-
if (PTR_ERR(tzd) != -ENODEV)
return PTR_ERR(tzd);
--
2.43.0
Powered by blists - more mailing lists