Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[cascardo/linux.git] / drivers / staging / iio / accel / adis16240_core.c
index 4a4eafc..aee8b69 100644 (file)
@@ -370,13 +370,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')