]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ipmi: Cleanup oops on initialization failure
authorCorey Minyard <cminyard@mvista.com>
Wed, 20 Jun 2018 12:19:01 +0000 (07:19 -0500)
committerCorey Minyard <cminyard@mvista.com>
Sun, 24 Jun 2018 23:11:38 +0000 (18:11 -0500)
Commit 93c303d2045b3 "ipmi_si: Clean up shutdown a bit" didn't
copy the behavior of the cleanup in one spot, it needed to
check for a non-NULL interface before cleaning it up.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Tested-by: Meelis Roos <mroos@linux.ee>
drivers/char/ipmi/ipmi_si_intf.c

index ad353be871bf005c6c0ca875d663bed49906c302..90ec010bffbd9776c012586b4e01b24cdd0bd2d6 100644 (file)
@@ -2088,8 +2088,10 @@ static int try_smi_init(struct smi_info *new_smi)
        return 0;
 
 out_err:
-       ipmi_unregister_smi(new_smi->intf);
-       new_smi->intf = NULL;
+       if (new_smi->intf) {
+               ipmi_unregister_smi(new_smi->intf);
+               new_smi->intf = NULL;
+       }
 
        kfree(init_name);