staging: iio: isl29018: change isl29018_read_raw() to only have one exit point
authorBrian Masney <masneyb@onstation.org>
Tue, 27 Sep 2016 00:20:19 +0000 (20:20 -0400)
committerJonathan Cameron <jic23@kernel.org>
Sat, 1 Oct 2016 13:55:34 +0000 (14:55 +0100)
When the chip is in a suspended state, isl29018_read_raw() will return
-EBUSY. Change the function so that it only has a single exit point.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/light/isl29018.c

index 990c6e52bafe32b31f5e8d5859ae6bf5ae43f68d..3a4d79d7e23c74fcc7438f465dcb8d1ffcaee53b 100644 (file)
@@ -390,8 +390,8 @@ static int isl29018_read_raw(struct iio_dev *indio_dev,
 
        mutex_lock(&chip->lock);
        if (chip->suspended) {
-               mutex_unlock(&chip->lock);
-               return -EBUSY;
+               ret = -EBUSY;
+               goto read_done;
        }
        switch (mask) {
        case IIO_CHAN_INFO_RAW:
@@ -438,6 +438,8 @@ static int isl29018_read_raw(struct iio_dev *indio_dev,
        default:
                break;
        }
+
+read_done:
        mutex_unlock(&chip->lock);
        return ret;
 }