From: "a.shimko" <artyom.shimko@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: "a.shimko" <artyom.shimko@gmail.com>,
linux-kernel@vger.kernel.org, sudeep.holla@arm.com,
cristian.marussi@arm.com, jdelvare@suse.com,
guenter.roeck@linux.com
Subject: [PATCH 2/3] hwmon: scmi: Remove redundant devm_kfree call
Date: Tue, 5 Aug 2025 15:43:58 +0300 [thread overview]
Message-ID: <20250805125003.12573-3-artyom.shimko@gmail.com> (raw)
In-Reply-To: <20250805125003.12573-1-artyom.shimko@gmail.com>
From: Artem Shimko <artyom.shimko@gmail.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@gmail.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
next prev parent reply other threads:[~2025-08-05 12:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 12:43 [PATCH v2 0/3] hwmon: scmi: Driver improvements and fixes a.shimko
2025-08-05 12:43 ` [PATCH 1/3] hwmon: scmi: Add default case with debug output a.shimko
2025-08-05 13:10 ` Guenter Roeck
2025-08-06 15:12 ` kernel test robot
2025-08-05 12:43 ` a.shimko [this message]
2025-08-05 13:13 ` [PATCH 2/3] hwmon: scmi: Remove redundant devm_kfree call Guenter Roeck
2025-08-05 12:43 ` [PATCH 3/3] hwmon: scmi: Enhance error reporting with dev_err_probe a.shimko
2025-08-05 13:20 ` Guenter Roeck
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=20250805125003.12573-3-artyom.shimko@gmail.com \
--to=artyom.shimko@gmail.com \
--cc=cristian.marussi@arm.com \
--cc=guenter.roeck@linux.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.