linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: Lars-Peter Clausen <lars@metafoo.de>, <linux-kernel@vger.kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	<linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: inkern: fix a static checker error
Date: Mon, 24 Apr 2017 11:32:37 +0200	[thread overview]
Message-ID: <60934fcd-214e-3618-84ff-46484197e737@axentia.se> (raw)
In-Reply-To: <7b6ad5b7-a538-9007-8981-f36f9877a8e3@axentia.se>

On 2017-04-20 23:13, Peter Rosin wrote:
> On 2017-04-20 23:12, Lars-Peter Clausen wrote:
>> On 04/20/2017 11:01 PM, Peter Rosin wrote:
>>> Avoid this smatch error:
>>> drivers/iio/inkern.c:751 iio_read_avail_channel_raw() error: double unlock 'mutex:&chan->indio_dev->info_exist_lock'
>>
>> Looks good, but it's not just the smatch error, this is a real issue. This
>> even seems to be a endless loop, always jumping back to err_unlock.
> 
> Yes, it should probably go to stable too...

Nope, not an endless loop, but I of course only noticed after sending
a v2 [1] which falsely stated just that. Ignore that v2 patch and take
this one instead, for the reasons stated in my followup [2] to that
message.

Involving stable is probably not needed either...

Cheers,
peda

[1] https://lkml.org/lkml/2017/4/24/179
[2] https://lkml.org/lkml/2017/4/24/221

>>>
>>> Fixes: 00c5f80c2fad ("iio: inkern: add helpers to query available values from channels")
>>> Signed-off-by: Peter Rosin <peda@axentia.se>
>>
>>> ---
>>>  drivers/iio/inkern.c | 4 +---
>>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
>>> index 7a13535dc3e9..a3941bade6a7 100644
>>> --- a/drivers/iio/inkern.c
>>> +++ b/drivers/iio/inkern.c
>>> @@ -750,11 +750,9 @@ int iio_read_avail_channel_raw(struct iio_channel *chan,
>>>  err_unlock:
>>>  	mutex_unlock(&chan->indio_dev->info_exist_lock);
>>>  
>>> -	if (ret >= 0 && type != IIO_VAL_INT) {
>>> +	if (ret >= 0 && type != IIO_VAL_INT)
>>>  		/* raw values are assumed to be IIO_VAL_INT */
>>>  		ret = -EINVAL;
>>> -		goto err_unlock;
>>> -	}
>>>  
>>>  	return ret;
>>>  }
>>>
>>
> 

  reply	other threads:[~2017-04-24  9:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 21:01 [PATCH] iio: inkern: fix a static checker error Peter Rosin
2017-04-20 21:12 ` Lars-Peter Clausen
2017-04-20 21:13   ` Peter Rosin
2017-04-24  9:32     ` Peter Rosin [this message]
2017-04-25 16:01       ` Lars-Peter Clausen
2017-04-25 17:11         ` Peter Rosin
2017-04-26  5:04       ` Jonathan Cameron

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=60934fcd-214e-3618-84ff-46484197e737@axentia.se \
    --to=peda@axentia.se \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).