From 44f56a39addecd6e93b8aa6fa51a6255259edbbb Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Wed, 24 Apr 2019 10:11:16 -0500 Subject: [PATCH] ipmi:ssif: Only unregister the platform driver if it was registered Otherwise you will get an error when the driver is removed if you set trydmi=0. Signed-off-by: Corey Minyard --- drivers/char/ipmi/ipmi_ssif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index aaccb0ff1ea6..be329f791c95 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -2111,7 +2111,8 @@ static void cleanup_ipmi_ssif(void) kfree(ssif_i2c_driver.address_list); - platform_driver_unregister(&ipmi_driver); + if (ssif_trydmi) + platform_driver_unregister(&ipmi_driver); free_ssif_clients(); }