diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-31 12:58:15 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-31 12:58:15 -0800 |
commit | 4c6790c49a8aa044b7b4c275ed556ef512866092 (patch) | |
tree | 449cd491df468792e97f9c014df49d244bc69a07 /drivers/char/ipmi/ipmi_si_intf.c | |
parent | 972058ad79b124086d931b6a0a25fb9bb52502dc (diff) | |
parent | e45af3d372f1d4339663dcbef28665f5b15d448c (diff) |
Merge tag 'for-linus-4.16-1' of git://github.com/cminyard/linux-ipmi
Pull IPMI updates from Corey Minyard:
"Small fixes for various things, been sitting in next for a while (some
a long time)"
* tag 'for-linus-4.16-1' of git://github.com/cminyard/linux-ipmi:
ipmi_ssif: Remove duplicate NULL check
ipmi/powernv: Fix error return code in ipmi_powernv_probe()
ipmi: use dynamic memory for DMI driver override
ipmi/ipmi_powernv: remove outdated todo in powernv IPMI driver
ipmi: Clear smi_info->thread to prevent use-after-free during module unload
ipmi: use correct string length
ipmi_si: Fix error handling of platform device
ipmi watchdog: fix typo in parameter description
ipmi_si_platform: Fix typo in parameter description
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 71fad747c0c7..6768cb2dd740 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -1938,8 +1938,10 @@ static void check_for_broken_irqs(struct smi_info *smi_info) static inline void stop_timer_and_thread(struct smi_info *smi_info) { - if (smi_info->thread != NULL) + if (smi_info->thread != NULL) { kthread_stop(smi_info->thread); + smi_info->thread = NULL; + } smi_info->timer_can_start = false; if (smi_info->timer_running) @@ -2045,6 +2047,7 @@ static int try_smi_init(struct smi_info *new_smi) int rv = 0; int i; char *init_name = NULL; + bool platform_device_registered = false; pr_info(PFX "Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n", ipmi_addr_src_to_str(new_smi->io.addr_source), @@ -2173,6 +2176,7 @@ static int try_smi_init(struct smi_info *new_smi) rv); goto out_err; } + platform_device_registered = true; } dev_set_drvdata(new_smi->io.dev, new_smi); @@ -2279,10 +2283,11 @@ out_err: } if (new_smi->pdev) { - platform_device_unregister(new_smi->pdev); + if (platform_device_registered) + platform_device_unregister(new_smi->pdev); + else + platform_device_put(new_smi->pdev); new_smi->pdev = NULL; - } else if (new_smi->pdev) { - platform_device_put(new_smi->pdev); } kfree(init_name); |