platform/x86: dell-wmi-sysman: Fix class device unregistration
authorKurt Borja <kuurtb@gmail.com>
Thu, 26 Jun 2025 01:17:37 +0000 (22:17 -0300)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 30 Jun 2025 09:12:17 +0000 (12:12 +0300)
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.

Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Link: https://lore.kernel.org/r/20250625-dest-fix-v1-3-3a0f342312bb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c

index 3c74d5e8350a413a55739ca5e9647be30bac50d4..f5402b714657297e0ab4bb52a988fcc4c787a5fb 100644 (file)
@@ -597,7 +597,7 @@ err_release_attributes_data:
        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 @@ err_exit_bios_attr_set_interface:
 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();
 }