platform/x86: Fix fiwmare_attributes_class device unregistration
Subsystems (5)
cover platform/x86: Fix fiwmare_attributes_class device unregistration
Hi all,
Using device_destroy() for unregistering firmware_attributes_class devices may cause issues if there is more than one device under this class. See details in the commit message.
This patchset fixes this problem for all users.
---
Kurt Borja (3):
platform/x86: hp-bioscfg: Fix class device unregistration platform/x86: think-lmi: Fix class device unregistration platform/x86: dell-wmi-sysman: Fix class device unregistration
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 4 ++-- drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 4 ++-- drivers/platform/x86/lenovo/think-lmi.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
---
base-commit: 73f0f2b52c5ea67b3140b23f58d8079d158839c8
change-id: 20250625-dest-fix-b9de524340b2
Signature · 1 line
~ Kurt
PATCH 1/3 platform/x86: hp-bioscfg: Fix class device unregistration
Devices under the firmware_attributes_class do not have unique a dev_t. Therefore, device_unregister() should be used instead of device_destroy(), since the latter may match any device with a given dev_t.
--- drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +2 -2
@@ -1034,7 +1034,7 @@ static int __init hp_init(void)release_attributes_data (); err_destroy_classdev: -device_destroy (&firmware_attributes_class,MKDEV (0 ,0 )); +device_unregister (bioscfg_drv.class_dev); err_unregister_class:hp_exit_attr_set_interface ();
@@ -1045,7 +1045,7 @@ static int __init hp_init(void) static void __exit hp_exit(void) {release_attributes_data (); -device_destroy (&firmware_attributes_class,MKDEV (0 ,0 )); +device_unregister (bioscfg_drv.class_dev);hp_exit_attr_set_interface (); }
Signature · 1 line
2.50.0
PATCH 2/3 platform/x86: think-lmi: Fix class device unregistration
In reply to Kurt BorjaDevices under the firmware_attributes_class do not have unique a dev_t. Therefore, device_unregister() should be used instead of device_destroy(), since the latter may match any device with a given dev_t.
--- drivers/platform/x86/lenovo/think-lmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/lenovo/think-lmi.c +2 -2
@@ -1556,7 +1556,7 @@ static int tlmi_sysfs_init(void) fail_create_attr:tlmi_release_attr (); fail_device_created: -device_destroy (&firmware_attributes_class,MKDEV (0 ,0 )); +device_unregister (tlmi_priv.class_dev); fail_class_created:return ret; }
@@ -1783,7 +1783,7 @@ static int tlmi_analyze(struct wmi_device *wdev)static void tlmi_remove (struct wmi_device *wdev) {tlmi_release_attr (); -device_destroy (&firmware_attributes_class,MKDEV (0 ,0 )); +device_unregister (tlmi_priv.class_dev); }static int tlmi_probe (struct wmi_device *wdev,const void *context)
Signature · 1 line
2.50.0
PATCH 3/3 platform/x86: dell-wmi-sysman: Fix class device unregistration
In reply to Kurt BorjaDevices under the firmware_attributes_class do not have unique a dev_t. Therefore, device_unregister() should be used instead of device_destroy(), since the latter may match any device with a given dev_t.
--- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +2 -2
@@ -597,7 +597,7 @@ static int __init sysman_init(void)release_attributes_data (); err_destroy_classdev: -device_destroy (&firmware_attributes_class,MKDEV (0 ,0 )); +device_unregister (wmi_priv.class_dev); err_exit_bios_attr_pass_interface:exit_bios_attr_pass_interface ();
@@ -611,7 +611,7 @@ static int __init sysman_init(void) static void __exit sysman_exit(void) {release_attributes_data (); -device_destroy (&firmware_attributes_class,MKDEV (0 ,0 )); +device_unregister (wmi_priv.class_dev);exit_bios_attr_set_interface ();exit_bios_attr_pass_interface (); }
Signature · 1 line
2.50.0
Ilpo Järvinen
maintainerQuoted 8 lines · Kurt Borja
Using
device_destroy()for unregisteringfirmware_attributes_classdevices may cause issues if there is more than one device under this class. See details in the commit message.This patchset fixes this problem for all users.
[...]
Thank you for your contribution, it has been applied to my local review-ilpo-fixes branch. Note it will show up in the public platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/3] platform/x86: hp-bioscfg: Fix class device unregistration
commit: 11cba4793b95df3bc192149a6eb044f69aa0b99e
[2/3] platform/x86: think-lmi: Fix class device unregistration
commit: 5ff1fbb3059730700b4823f43999fc1315984632
[3/3] platform/x86: dell-wmi-sysman: Fix class device unregistration
commit: 314e5ad4782d08858b3abc325c0487bd2abc23a1--
i.