Skip to content

Commit 561f818

Browse files
Yinghai Lutorvalds
authored andcommitted
ipmi: fix hardcoded ipmi device exit path warning
When modprobe.conf has options ipmi_si type="kcs" ports=0xCA2 regspacings="4" ipmi_si can be loaded properly, but when try to unload it get: Sep 20 15:00:27 xx abrt: Kerneloops: Reported 1 kernel oopses to Abrt Sep 20 15:00:27 xx abrtd: Directory 'kerneloops-1285020027-1' creation detected Sep 20 15:00:27 xx abrtd: New crash /var/spool/abrt/kerneloops-1285020027-1, processing Sep 20 15:01:09 xx kernel: ------------[ cut here ]------------ Sep 20 15:01:09 xx kernel: WARNING: at drivers/base/driver.c:262 driver_unregister+0x8a/0xa0() Sep 20 15:01:09 xx kernel: Hardware name: Sun Fire x4800 Sep 20 15:01:09 xx kernel: Unexpected driver unregister! Sep 20 15:01:09 xx kernel: Modules linked in: ipmi_si(-) ipmi_msghandler ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat bridge stp llc autofs4 sunrpc cpufreq_ondemand acpi_cpufreq freq_table mperf xt_physdev be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb3i iw_cxgb3 cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi dm_mirror dm_region_hash dm_log dm_mod vhost_net macvtap macvlan tun kvm_intel kvm uinput sg ses enclosure ahci libahci pcspkr i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support igb dca i7core_edac edac_core ext3 jbd mbcache sd_mod crc_t10dif megaraid_sas [last unloaded: ipmi_devintf] Sep 20 15:01:09 xx kernel: Pid: 10625, comm: modprobe Tainted: G W 2.6.36-rc5-tip+ #6 Sep 20 15:01:09 xx kernel: Call Trace: Sep 20 15:01:09 xx kernel: [<ffffffff810600df>] warn_slowpath_common+0x7f/0xc0 Sep 20 15:01:09 xx kernel: [<ffffffff810601d6>] warn_slowpath_fmt+0x46/0x50 Sep 20 15:01:09 xx kernel: [<ffffffff812ff60a>] driver_unregister+0x8a/0xa0 Sep 20 15:01:09 xx kernel: [<ffffffff812ae112>] pnp_unregister_driver+0x12/0x20 Sep 20 15:01:09 xx kernel: [<ffffffffa01d0327>] cleanup_ipmi_si+0x3c/0xa7 [ipmi_si] Sep 20 15:01:09 xx kernel: [<ffffffff81099a60>] sys_delete_module+0x1a0/0x270 Sep 20 15:01:09 xx kernel: [<ffffffff814b7070>] ? do_page_fault+0x150/0x320 Sep 20 15:01:09 xx kernel: [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b Sep 20 15:01:09 xx kernel: ---[ end trace 0d1967161adcee0d ]--- We need to check if ipmi_pnp_driver is loaded before we try to unload it. Signed-off-by: Yinghai Lu <[email protected]> Cc: Corey Minyard <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f501ed5 commit 561f818

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ static int num_force_kipmid;
305305
#ifdef CONFIG_PCI
306306
static int pci_registered;
307307
#endif
308+
#ifdef CONFIG_ACPI
309+
static int pnp_registered;
310+
#endif
308311
#ifdef CONFIG_PPC_OF
309312
static int of_registered;
310313
#endif
@@ -3359,6 +3362,7 @@ static __devinit int init_ipmi_si(void)
33593362

33603363
#ifdef CONFIG_ACPI
33613364
pnp_register_driver(&ipmi_pnp_driver);
3365+
pnp_registered = 1;
33623366
#endif
33633367

33643368
#ifdef CONFIG_DMI
@@ -3526,7 +3530,8 @@ static __exit void cleanup_ipmi_si(void)
35263530
pci_unregister_driver(&ipmi_pci_driver);
35273531
#endif
35283532
#ifdef CONFIG_ACPI
3529-
pnp_unregister_driver(&ipmi_pnp_driver);
3533+
if (pnp_registered)
3534+
pnp_unregister_driver(&ipmi_pnp_driver);
35303535
#endif
35313536

35323537
#ifdef CONFIG_PPC_OF

0 commit comments

Comments
 (0)