From: Guenter Roeck <linux@roeck-us.net>
To: Damien Riegel <damien.riegel@savoirfairelinux.com>,
linux-watchdog@vger.kernel.org
Cc: Wim Van Sebroeck <wim@iguana.be>, kernel@savoirfairelinux.com
Subject: Re: [PATCH v2 1/2] watchdog: core: call device_destroy before watchdog_dev_unregister
Date: Tue, 24 Nov 2015 18:20:11 -0800 [thread overview]
Message-ID: <56551ADB.3000107@roeck-us.net> (raw)
In-Reply-To: <1448408745-26719-1-git-send-email-damien.riegel@savoirfairelinux.com>
On 11/24/2015 03:45 PM, Damien Riegel wrote:
> device_create is called after watchdog_dev_register, so it makes more
> sense to call the cleanup functions in reverse order, ie. device_destroy
> before watchdog_dev_unregister.
>
> Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/watchdog_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 551af04..e70b6e8 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
> @@ -264,8 +264,8 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
> if (ret) {
> dev_err(wdd->dev, "Cannot register reboot notifier (%d)\n",
> ret);
> - watchdog_dev_unregister(wdd);
> device_destroy(watchdog_class, devno);
> + watchdog_dev_unregister(wdd);
> ida_simple_remove(&watchdog_ida, wdd->id);
> wdd->dev = NULL;
> return ret;
> @@ -324,10 +324,10 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd)
> unregister_reboot_notifier(&wdd->reboot_nb);
>
> devno = wdd->cdev.dev;
> + device_destroy(watchdog_class, devno);
> ret = watchdog_dev_unregister(wdd);
> if (ret)
> pr_err("error unregistering /dev/watchdog (err=%d)\n", ret);
> - device_destroy(watchdog_class, devno);
> ida_simple_remove(&watchdog_ida, wdd->id);
> wdd->dev = NULL;
> }
>
next prev parent reply other threads:[~2015-11-25 2:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 23:45 [PATCH v2 1/2] watchdog: core: call device_destroy before watchdog_dev_unregister Damien Riegel
2015-11-24 23:45 ` [PATCH v2 2/2] watchdog: core: factorize register error paths Damien Riegel
2015-11-25 2:20 ` Guenter Roeck
2015-11-25 2:20 ` Guenter Roeck [this message]
2015-11-25 17:09 ` [PATCH v2 1/2] watchdog: core: call device_destroy before watchdog_dev_unregister Damien Riegel
2015-11-25 17:57 ` Guenter Roeck
2015-11-25 22:43 ` Damien Riegel
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=56551ADB.3000107@roeck-us.net \
--to=linux@roeck-us.net \
--cc=damien.riegel@savoirfairelinux.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/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.