iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw()
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Mon, 6 Jul 2020 11:02:57 +0000 (14:02 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 09:02:07 +0000 (11:02 +0200)
commit198de686fd9df30f2d8de399c17c06a16cb610d2
treecac63f655573c04b9dbadeb9c4868c5914e73568
parentfab88db1bd99e314b2d49bd6a55356a2a61a17ab
iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw()

commit 65afb0932a81c1de719ceee0db0b276094b10ac8 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 56ca9db862bf3: ("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>
drivers/iio/dac/ad5592r-base.c