Skip to content

Commit

Permalink
iio:accel:kxsd9 fix missing mutex unlock
Browse files Browse the repository at this point in the history
This will leave a lock held after reading from the device, preventing
any further reads.

Signed-off-by: Frank Zago <frank@zago.net>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Frank Zago authored and Jonathan Cameron committed Nov 17, 2013
1 parent fe26980 commit 0ee005c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/iio/accel/kxsd9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0ee005c

Please sign in to comment.