summaryrefslogtreecommitdiff
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2018-04-11 21:53:52 +0300
committerCorey Minyard <cminyard@mvista.com>2018-04-18 18:23:11 +0300
commit93c303d2045b30572d8d5e74d3ad80692acfebbe (patch)
tree6d017ff83e07e63f1abb3d4293a0f9bfa0b24dd3 /drivers/char/ipmi
parent57bccb4e8755d092f4c3c9e356a18f89a1488490 (diff)
downloadlinux-93c303d2045b30572d8d5e74d3ad80692acfebbe.tar.xz
ipmi_si: Clean up shutdown a bit
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 7352d8fe73f8..f2c39bf91bf5 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -261,7 +261,6 @@ static int num_max_busy_us;
static bool unload_when_empty = true;
static int try_smi_init(struct smi_info *smi);
-static void shutdown_one_si(struct smi_info *smi_info);
static void cleanup_one_si(struct smi_info *smi_info);
static void cleanup_ipmi_si(void);
@@ -2003,14 +2002,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
list_add_tail(&new_smi->link, &smi_infos);
- if (initialized) {
+ if (initialized)
rv = try_smi_init(new_smi);
- if (rv) {
- cleanup_one_si(new_smi);
- mutex_unlock(&smi_infos_lock);
- return rv;
- }
- }
out_err:
mutex_unlock(&smi_infos_lock);
return rv;
@@ -2220,7 +2213,8 @@ static int try_smi_init(struct smi_info *new_smi)
return 0;
out_err:
- shutdown_one_si(new_smi);
+ ipmi_unregister_smi(new_smi->intf);
+ new_smi->intf = NULL;
kfree(init_name);
@@ -2358,17 +2352,10 @@ static void shutdown_smi(void *send_info)
smi_info->si_sm = NULL;
}
-static void shutdown_one_si(struct smi_info *smi_info)
-{
- ipmi_smi_t intf = smi_info->intf;
-
- if (!intf)
- return;
-
- smi_info->intf = NULL;
- ipmi_unregister_smi(intf);
-}
-
+/*
+ * Must be called with smi_infos_lock held, to serialize the
+ * smi_info->intf check.
+ */
static void cleanup_one_si(struct smi_info *smi_info)
{
if (!smi_info)
@@ -2376,7 +2363,10 @@ static void cleanup_one_si(struct smi_info *smi_info)
list_del(&smi_info->link);
- shutdown_one_si(smi_info);
+ if (smi_info->intf) {
+ ipmi_unregister_smi(smi_info->intf);
+ smi_info->intf = NULL;
+ }
if (smi_info->pdev) {
if (smi_info->pdev_registered)