mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw()
commit65afb0932aupstream. 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. Fixes56ca9db862: ("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
75a04a370d
commit
13d49c2043
@@ -415,7 +415,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
|
|||||||
s64 tmp = *val * (3767897513LL / 25LL);
|
s64 tmp = *val * (3767897513LL / 25LL);
|
||||||
*val = div_s64_rem(tmp, 1000000000LL, val2);
|
*val = div_s64_rem(tmp, 1000000000LL, val2);
|
||||||
|
|
||||||
ret = IIO_VAL_INT_PLUS_MICRO;
|
return IIO_VAL_INT_PLUS_MICRO;
|
||||||
} else {
|
} else {
|
||||||
int mult;
|
int mult;
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
|
|||||||
ret = IIO_VAL_INT;
|
ret = IIO_VAL_INT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
|
|||||||
Reference in New Issue
Block a user