Skip to content

Commit

Permalink
Staging: iio: release locks on error paths
Browse files Browse the repository at this point in the history
There are a couple places here where we should have called
mutex_unlock() before returning.

Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
error27 authored and gregkh committed Jul 6, 2011
1 parent 7bcf302 commit 85ee35e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/staging/iio/accel/adis16201_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,17 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock);
addr = adis16201_addresses[chan->address][0];
ret = adis16201_spi_read_reg_16(indio_dev, addr, &val16);
if (ret)
if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret;
}

if (val16 & ADIS16201_ERROR_ACTIVE) {
ret = adis16201_check_status(indio_dev);
if (ret)
if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret;
}
}
val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
if (chan->scan_type.sign == 's')
Expand Down

0 comments on commit 85ee35e

Please sign in to comment.