mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	openipmi-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH] ipmi_si: fix unexpected driver unregister warning
Date: Fri, 17 May 2019 11:18:21 -0500	[thread overview]
Message-ID: <20190517161821.GB11017@minyard.net> (raw)
In-Reply-To: <20190517101245.4341-1-wangkefeng.wang@huawei.com>

On Fri, May 17, 2019 at 06:12:44PM +0800, Kefeng Wang wrote:
> If ipmi_si_platform_init()->platform_driver_register() fails,
> platform_driver_unregister() called unconditionally will trigger
> following warning,
> 
> ipmi_platform: Unable to register driver: -12
> ------------[ cut here ]------------
> Unexpected driver unregister!
> WARNING: CPU: 1 PID: 7210 at drivers/base/driver.c:193 driver_unregister+0x60/0x70 drivers/base/driver.c:193
> 
> Fix it by adding platform_registered variable, only unregister platform
> driver when it is already successfully registered.

This is good, but have you found out why the driver was unable to
register in the first place?  That really shouldn't happen.

This patch is queued for 5.3.

-corey

> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/char/ipmi/ipmi_si_platform.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c
> index f2a91c4d8cab..0cd849675d99 100644
> --- a/drivers/char/ipmi/ipmi_si_platform.c
> +++ b/drivers/char/ipmi/ipmi_si_platform.c
> @@ -19,6 +19,7 @@
>  #include "ipmi_si.h"
>  #include "ipmi_dmi.h"
>  
> +static bool platform_registered;
>  static bool si_tryplatform = true;
>  #ifdef CONFIG_ACPI
>  static bool          si_tryacpi = true;
> @@ -469,9 +470,12 @@ void ipmi_si_platform_init(void)
>  	int rv = platform_driver_register(&ipmi_platform_driver);
>  	if (rv)
>  		pr_err("Unable to register driver: %d\n", rv);
> +	else
> +		platform_registered = true;
>  }
>  
>  void ipmi_si_platform_shutdown(void)
>  {
> -	platform_driver_unregister(&ipmi_platform_driver);
> +	if (platform_registered)
> +		platform_driver_unregister(&ipmi_platform_driver);
>  }
> -- 
> 2.20.1
> 

  parent reply	other threads:[~2019-05-17 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 10:12 Kefeng Wang
2019-05-17 10:12 ` [PATCH] ipmi_si: use bool type for initialized variable Kefeng Wang
2019-05-17 16:18   ` Corey Minyard
2019-05-17 16:18 ` Corey Minyard [this message]
2019-05-18  7:40   ` [PATCH] ipmi_si: fix unexpected driver unregister warning Kefeng Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190517161821.GB11017@minyard.net \
    --to=minyard@acm.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hulkci@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®