linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Wei Yongjun <weiyj_lk@163.com>, Wim Van Sebroeck <wim@iguana.be>
Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
	linux-watchdog@vger.kernel.org
Subject: Re: [PATCH -next] watchdog: core: Fix error handling of watchdog_dev_init()
Date: Tue, 19 Jul 2016 07:33:15 -0700	[thread overview]
Message-ID: <578E3A2B.802@roeck-us.net> (raw)
In-Reply-To: <1468927354-32155-1-git-send-email-weiyj_lk@163.com>

On 07/19/2016 04:22 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix the error handling paths of watchdog_dev_init().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/watchdog_dev.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index 14f8a92..f6e6751 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -952,17 +952,22 @@ int __init watchdog_dev_init(void)
>   	err = class_register(&watchdog_class);
>   	if (err < 0) {
>   		pr_err("couldn't register class\n");
> -		return err;
> +		goto err_register;
>   	}
>
>   	err = alloc_chrdev_region(&watchdog_devt, 0, MAX_DOGS, "watchdog");
>   	if (err < 0) {
>   		pr_err("watchdog: unable to allocate char dev region\n");
> -		class_unregister(&watchdog_class);
> -		return err;
> +		goto err_alloc;
>   	}
>
>   	return 0;
> +
> +err_alloc:
> +	class_unregister(&watchdog_class);
> +err_register:
> +	destroy_workqueue(watchdog_wq);
> +	return err;
>   }
>
>   /*
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


      reply	other threads:[~2016-07-19 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 11:22 [PATCH -next] watchdog: core: Fix error handling of watchdog_dev_init() Wei Yongjun
2016-07-19 14:33 ` Guenter Roeck [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=578E3A2B.802@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=weiyj_lk@163.com \
    --cc=wim@iguana.be \
    --cc=yongjun_wei@trendmicro.com.cn \
    /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;
as well as URLs for NNTP newsgroup(s).