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 <masn...@onstation.org>
---
 drivers/staging/iio/light/isl29018.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/isl29018.c 
b/drivers/staging/iio/light/isl29018.c
index 990c6e5..3a4d79d 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -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;
 }
-- 
2.7.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to