linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org
Subject: Re: [PATCH 1/7] i2c: free idr when sanity checks in i2c_register_adapter() fail
Date: Mon, 11 Jul 2016 13:51:17 +0200	[thread overview]
Message-ID: <20160711135117.6b836415@endymion> (raw)
In-Reply-To: <1468038904-2571-2-git-send-email-wsa@the-dreams.de>

On Sat,  9 Jul 2016 13:34:58 +0900, Wolfram Sang wrote:
> On error, we should give idr back to the pool in any case.
> 
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> Cc: Jean Delvare <jdelvare@suse.de>
> ---
>  drivers/i2c/i2c-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 71ad532be1d891..7e6ff6d4cf659a 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1560,7 +1560,7 @@ static int __process_new_adapter(struct device_driver *d, void *data)
>  
>  static int i2c_register_adapter(struct i2c_adapter *adap)
>  {
> -	int res = 0;
> +	int res = -EINVAL;
>  
>  	/* Can't register until after driver model init */
>  	if (WARN_ON(!is_registered)) {
> @@ -1572,12 +1572,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  	if (unlikely(adap->name[0] == '\0')) {
>  		pr_err("i2c-core: Attempt to register an adapter with "
>  		       "no name!\n");
> -		return -EINVAL;
> +		goto out_list;
>  	}
>  	if (unlikely(!adap->algo)) {
>  		pr_err("i2c-core: Attempt to register adapter '%s' with "
>  		       "no algo!\n", adap->name);
> -		return -EINVAL;
> +		goto out_list;
>  	}
>  
>  	if (!adap->lock_bus) {

Good catch.

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2016-07-11 11:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-09  4:34 [PATCH 0/7] i2c: improve error messages when registering an adapter Wolfram Sang
2016-07-09  4:34 ` [PATCH 1/7] i2c: free idr when sanity checks in i2c_register_adapter() fail Wolfram Sang
2016-07-11 11:51   ` Jean Delvare [this message]
2016-07-09  4:34 ` [PATCH 2/7] i2c: cleanup i2c_register_adapter() by refactoring recovery init Wolfram Sang
2016-07-09  4:35 ` [PATCH 3/7] i2c: improve error messages in i2c_register_adapter() Wolfram Sang
2016-07-09  4:35 ` [PATCH 4/7] i2c: add error message when obtaining idr fails Wolfram Sang
2016-07-09  4:35 ` [PATCH 5/7] i2c: print more info when of_i2c_notify fails Wolfram Sang
2016-07-09  4:35 ` [PATCH 6/7] i2c: print more info when acpi_i2c_space_handler() fails Wolfram Sang
2016-07-09  8:11   ` Mika Westerberg
2016-07-09  4:35 ` [PATCH 7/7] i2c: use pr_fmt in the core Wolfram Sang
2016-07-14 12:47 ` [PATCH 0/7] i2c: improve error messages when registering an adapter Wolfram Sang

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=20160711135117.6b836415@endymion \
    --to=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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).