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_ssif: fix unexpected driver unregister warning
Date: Fri, 24 May 2019 10:06:07 -0500 [thread overview]
Message-ID: <20190524150607.GD2742@minyard.net> (raw)
In-Reply-To: <20190524143724.43218-1-wangkefeng.wang@huawei.com>
On Fri, May 24, 2019 at 10:37:24PM +0800, Kefeng Wang wrote:
> If platform_driver_register() fails from init_ipmi_ssif(),
> platform_driver_unregister() called unconditionally will
> trigger following warning,
Yep, same as the ipmi_si change before. Thanks, it's in my
next tree queued for the next cycle.
-corey
>
> ipmi_ssif: Unable to register driver: -12
> ------------[ cut here ]------------
> Unexpected driver unregister!
> WARNING: CPU: 1 PID: 6305 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.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> drivers/char/ipmi/ipmi_ssif.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index cf8156d6bc07..305fa5054274 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -303,6 +303,7 @@ struct ssif_info {
> ((unsigned int) atomic_read(&(ssif)->stats[SSIF_STAT_ ## stat]))
>
> static bool initialized;
> +static bool platform_registered;
>
> static void return_hosed_msg(struct ssif_info *ssif_info,
> struct ipmi_smi_msg *msg);
> @@ -2088,6 +2089,8 @@ static int init_ipmi_ssif(void)
> rv = platform_driver_register(&ipmi_driver);
> if (rv)
> pr_err("Unable to register driver: %d\n", rv);
> + else
> + platform_registered = true;
> }
>
> ssif_i2c_driver.address_list = ssif_address_list();
> @@ -2111,7 +2114,7 @@ static void cleanup_ipmi_ssif(void)
>
> kfree(ssif_i2c_driver.address_list);
>
> - if (ssif_trydmi)
> + if (ssif_trydmi && platform_registered)
> platform_driver_unregister(&ipmi_driver);
>
> free_ssif_clients();
> --
> 2.20.1
>
prev parent reply other threads:[~2019-05-24 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 14:37 [PATCH] ipmi_ssif: fix unexpected driver unregister warning Kefeng Wang
2019-05-24 15:06 ` Corey Minyard [this message]
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=20190524150607.GD2742@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.