Skip to content

Commit b86f06e

Browse files
commodogregkh
authored andcommitted
iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw()
commit 65afb09 upstream. 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. Fixes 56ca9db: ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs") Reported-by: Charles Stanhope <charles.stanhope@gmail.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0d4abc3 commit b86f06e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iio/dac/ad5592r-base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
417417
s64 tmp = *val * (3767897513LL / 25LL);
418418
*val = div_s64_rem(tmp, 1000000000LL, val2);
419419

420-
ret = IIO_VAL_INT_PLUS_MICRO;
420+
return IIO_VAL_INT_PLUS_MICRO;
421421
} else {
422422
int mult;
423423

@@ -448,7 +448,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
448448
ret = IIO_VAL_INT;
449449
break;
450450
default:
451-
ret = -EINVAL;
451+
return -EINVAL;
452452
}
453453

454454
unlock:

0 commit comments

Comments
 (0)