Staging: iio: add some unlocks to raw_read() functions
Subsystems (5)
PATCH 1/1 Staging: iio: add some unlocks to raw_read() functions
This code was cut and pasted in several places. It's missing some unlocks on error.
Signed-off-by Dan Carpenter <[email protected]>
drivers/staging/iio/accel/adis16203_core.c +6 -2
@@ -312,13 +312,17 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock); addr = adis16203_addresses[chan->address][0 ]; ret =adis16203_spi_read_reg_16 (indio_dev, addr, &val16); -if (ret) +if (ret) { +mutex_unlock (&indio_dev->mlock);return ret; + }if (val16 &ADIS16203_ERROR_ACTIVE ) { ret =adis16203_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' )
drivers/staging/iio/accel/adis16204_core.c +6 -2
@@ -342,13 +342,17 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock); addr = adis16204_addresses[chan->address][0 ]; ret =adis16204_spi_read_reg_16 (indio_dev, addr, &val16); -if (ret) +if (ret) { +mutex_unlock (&indio_dev->mlock);return ret; + }if (val16 &ADIS16204_ERROR_ACTIVE ) { ret =adis16204_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' )
drivers/staging/iio/accel/adis16209_core.c +6 -2
@@ -338,13 +338,17 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock); addr = adis16209_addresses[chan->address][0 ]; ret =adis16209_spi_read_reg_16 (indio_dev, addr, &val16); -if (ret) +if (ret) { +mutex_unlock (&indio_dev->mlock);return ret; + }if (val16 &ADIS16209_ERROR_ACTIVE ) { ret =adis16209_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' )
drivers/staging/iio/accel/adis16240_core.c +6 -2
@@ -371,13 +371,17 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock); addr = adis16240_addresses[chan->address][0 ]; ret =adis16240_spi_read_reg_16 (indio_dev, addr, &val16); -if (ret) +if (ret) { +mutex_unlock (&indio_dev->mlock);return ret; + }if (val16 &ADIS16240_ERROR_ACTIVE ) { ret =adis16240_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' )
drivers/staging/iio/gyro/adis16260_core.c +6 -2
@@ -447,13 +447,17 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock); addr = adis16260_addresses[chan->address][0 ]; ret =adis16260_spi_read_reg_16 (indio_dev, addr, &val16); -if (ret) +if (ret) { +mutex_unlock (&indio_dev->mlock);return ret; + }if (val16 &ADIS16260_ERROR_ACTIVE ) { ret =adis16260_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' )