Skip to content

Commit 93c303d

Browse files
committed
ipmi_si: Clean up shutdown a bit
Signed-off-by: Corey Minyard <[email protected]>
1 parent 57bccb4 commit 93c303d

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ static int num_max_busy_us;
261261
static bool unload_when_empty = true;
262262

263263
static int try_smi_init(struct smi_info *smi);
264-
static void shutdown_one_si(struct smi_info *smi_info);
265264
static void cleanup_one_si(struct smi_info *smi_info);
266265
static void cleanup_ipmi_si(void);
267266

@@ -2003,14 +2002,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
20032002

20042003
list_add_tail(&new_smi->link, &smi_infos);
20052004

2006-
if (initialized) {
2005+
if (initialized)
20072006
rv = try_smi_init(new_smi);
2008-
if (rv) {
2009-
cleanup_one_si(new_smi);
2010-
mutex_unlock(&smi_infos_lock);
2011-
return rv;
2012-
}
2013-
}
20142007
out_err:
20152008
mutex_unlock(&smi_infos_lock);
20162009
return rv;
@@ -2220,7 +2213,8 @@ static int try_smi_init(struct smi_info *new_smi)
22202213
return 0;
22212214

22222215
out_err:
2223-
shutdown_one_si(new_smi);
2216+
ipmi_unregister_smi(new_smi->intf);
2217+
new_smi->intf = NULL;
22242218

22252219
kfree(init_name);
22262220

@@ -2358,25 +2352,21 @@ static void shutdown_smi(void *send_info)
23582352
smi_info->si_sm = NULL;
23592353
}
23602354

2361-
static void shutdown_one_si(struct smi_info *smi_info)
2362-
{
2363-
ipmi_smi_t intf = smi_info->intf;
2364-
2365-
if (!intf)
2366-
return;
2367-
2368-
smi_info->intf = NULL;
2369-
ipmi_unregister_smi(intf);
2370-
}
2371-
2355+
/*
2356+
* Must be called with smi_infos_lock held, to serialize the
2357+
* smi_info->intf check.
2358+
*/
23722359
static void cleanup_one_si(struct smi_info *smi_info)
23732360
{
23742361
if (!smi_info)
23752362
return;
23762363

23772364
list_del(&smi_info->link);
23782365

2379-
shutdown_one_si(smi_info);
2366+
if (smi_info->intf) {
2367+
ipmi_unregister_smi(smi_info->intf);
2368+
smi_info->intf = NULL;
2369+
}
23802370

23812371
if (smi_info->pdev) {
23822372
if (smi_info->pdev_registered)

0 commit comments

Comments
 (0)