Re: [PATCH] hwmon: (ibmaem) clean up sensors if version sysfs file fails
From: Guenter Roeck
Date: Tue Jun 16 2026 - 13:32:11 EST
On 6/14/26 23:46, Pengpeng Hou wrote:
aem_register_sensors() creates the dynamic sensor files and the name
sysfs file before creating the version file.
Errors from the dynamic sensor files and from the name file already jump
to aem_remove_sensors(), but an error from creating the version file is
returned directly. That leaves the earlier sysfs files published even
though the AEM instance probe fails and the backing state is torn down.
Route the version-file failure through the same cleanup path as the
earlier sysfs creation failures.
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/hwmon/ibmaem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
index 0a9c3a29e6f2..305c41dd15bb 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -945,6 +945,9 @@ static int aem_register_sensors(struct aem_data *data,
if (err)
goto error;
err = device_create_file(dev, &sensor_dev_attr_version.dev_attr);
+ if (err)
+ goto error;
+
return err;
error:
The main problem with this patch is that the hardware supported by the
driver ("x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2, and
certain HC10/HS2x/LS2x/QS2x blades") is no longer supported by Linux
distributions. On top of that, the driver uses a long since obsolete
API to register with the hwmon subsystem, triggering a kernel warning
whenever the driver is loaded.
That is a general problem with this and similar patches: They fix a
minor and unlikely to be seen problem while missing all the real issues
(as can be seen from Sashiko's feedback).
So, no, I am not going to apply this patch without evidence that the
driver is actually used.
Guenter