Skip to content

Commit

Permalink
platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios
Browse files Browse the repository at this point in the history
init_dell_smbios_wmi() only registers the dell_smbios_wmi_driver on systems
where the Dell WMI interface is supported. While exit_dell_smbios_wmi()
unregisters it unconditionally, this leads to the following oops:

[  175.722921] ------------[ cut here ]------------
[  175.722925] Unexpected driver unregister!
[  175.722939] WARNING: CPU: 1 PID: 3630 at drivers/base/driver.c:194 driver_unregister+0x38/0x40
...
[  175.723089] Call Trace:
[  175.723094]  cleanup_module+0x5/0xedd [dell_smbios]
...
[  175.723148] ---[ end trace 064c34e1ad49509d ]---

Make the unregister happen on the same condition the register happens
to fix this.

Cc: Mario Limonciello <mario.limonciello@outlook.com>
Fixes: 1a258e6 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mario Limonciello <mario.limonciello@outlook.com>
Reviewed-by: Mark Gross <mgross@linux.intel.com>
Link: https://lore.kernel.org/r/20210518125027.21824-1-hdegoede@redhat.com
  • Loading branch information
Hans de Goede committed May 19, 2021
1 parent f048630 commit 3a53587
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/platform/x86/dell/dell-smbios-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ int init_dell_smbios_wmi(void)

void exit_dell_smbios_wmi(void)
{
wmi_driver_unregister(&dell_smbios_wmi_driver);
if (wmi_supported)
wmi_driver_unregister(&dell_smbios_wmi_driver);
}

MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);

0 comments on commit 3a53587

Please sign in to comment.