linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Cc: "jic23@kernel.org" <jic23@kernel.org>,
	"charles.stanhope@gmail.com" <charles.stanhope@gmail.com>
Subject: Re: [PATCH 1/3] iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw()
Date: Mon, 6 Jul 2020 16:36:09 +0000	[thread overview]
Message-ID: <872263d31269c590c34b46ccb6517ec26a330c18.camel@analog.com> (raw)
In-Reply-To: <20200706110259.23947-1-alexandru.ardelean@analog.com>

On Mon, 2020-07-06 at 14:02 +0300, Alexandru Ardelean wrote:
> [External]
> 
> There are 2 exit paths where the lock isn't held, but try to unlock the
> mutex when exiting. In these places we should just return from the
> function.
> 
> A neater approach would be to cleanup the ad5592r_read_raw(), but that
> would make this patch more difficult to backport to stable versions.
> 

I was a bit too hasty with this.
Apologies.
I'd like to add a tag here.

Reported-by: Charles Stanhope <charles.stanhope@gmail.com>

> Fixes 56ca9db862bf3: ("iio: dac: Add support for the AD5592R/AD5593R
> ADCs/DACs")
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/dac/ad5592r-base.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-
> base.c
> index 5c4e5ff70380..cc4875660a69 100644
> --- a/drivers/iio/dac/ad5592r-base.c
> +++ b/drivers/iio/dac/ad5592r-base.c
> @@ -413,7 +413,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
>  			s64 tmp = *val * (3767897513LL / 25LL);
>  			*val = div_s64_rem(tmp, 1000000000LL, val2);
>  
> -			ret = IIO_VAL_INT_PLUS_MICRO;
> +			return IIO_VAL_INT_PLUS_MICRO;
>  		} else {
>  			int mult;
>  
> @@ -444,7 +444,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
>  		ret =  IIO_VAL_INT;
>  		break;
>  	default:
> -		ret = -EINVAL;
> +		return -EINVAL;
>  	}
>  
>  unlock:

  parent reply	other threads:[~2020-07-06 16:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 11:02 [PATCH 1/3] iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw() Alexandru Ardelean
2020-07-06 11:02 ` [PATCH 2/3] iio: dac: ad5592r: un-indent code-block for scale read Alexandru Ardelean
2020-07-06 11:02 ` [PATCH 3/3] iio: dac: ad5592r: localize locks only where needed in ad5592r_read_raw() Alexandru Ardelean
2020-09-17 18:42   ` Jonathan Cameron
2020-07-06 16:36 ` Ardelean, Alexandru [this message]
2020-07-12 11:16   ` [PATCH 1/3] iio: dac: ad5592r: fix unbalanced mutex unlocks " 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=872263d31269c590c34b46ccb6517ec26a330c18.camel@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=charles.stanhope@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).