summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorFrank Zago <frank@zago.net>2013-11-13 22:53:00 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 11:05:54 -0800
commitfd5cd457f8de18a96a59655a7c432fda96aaea60 (patch)
treef71d1b3af78b5e97dfb7e18d56deea96c5c9e53c /drivers/iio
parent5bdecef947f289555686de327a7bd5ac9142cfa7 (diff)
iio:accel:kxsd9 fix missing mutex unlock
commit 0ee005c7dc2803125275e24598f0fb37775a6af3 upstream. This will leave a lock held after reading from the device, preventing any further reads. Signed-off-by: Frank Zago <frank@zago.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/accel/kxsd9.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index 709c13259f14..34277153c211 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -112,9 +112,10 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
mutex_lock(&st->buf_lock);
st->tx[0] = KXSD9_READ(address);
ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
- if (ret)
- return ret;
- return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0);
+ if (!ret)
+ ret = (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0);
+ mutex_unlock(&st->buf_lock);
+ return ret;
}
static IIO_CONST_ATTR(accel_scale_available,