Commit 0ee005c7 authored by Frank Zago's avatar Frank Zago Committed by Jonathan Cameron

iio:accel:kxsd9 fix missing mutex unlock

This will leave a lock held after reading from the device, preventing
any further reads.
Signed-off-by: default avatarFrank Zago <frank@zago.net>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent fe26980e
...@@ -112,9 +112,10 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address) ...@@ -112,9 +112,10 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
mutex_lock(&st->buf_lock); mutex_lock(&st->buf_lock);
st->tx[0] = KXSD9_READ(address); st->tx[0] = KXSD9_READ(address);
ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
if (ret) if (!ret)
return ret; ret = (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0);
return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0); mutex_unlock(&st->buf_lock);
return ret;
} }
static IIO_CONST_ATTR(accel_scale_available, static IIO_CONST_ATTR(accel_scale_available,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment