staging: iio: isl29018: made error handling consistent
authorBrian Masney <masneyb@onstation.org>
Sun, 25 Sep 2016 11:41:06 +0000 (07:41 -0400)
committerJonathan Cameron <jic23@kernel.org>
Tue, 27 Sep 2016 20:08:47 +0000 (21:08 +0100)
Changed the processing of IIO_CHAN_INFO_INT_TIME in isl29018_write_raw()
to unlock the mutex and return at the end of the function if invalid
input is passed in. This makes the error handling code consistent with
the processing of IIO_CHAN_INFO_CALIBSCALE and IIO_CHAN_INFO_SCALE
within the same function.

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

index 2a055d6c32ba32d5feedd22d59bc389171065d0c..f03122c660450bdd3d032322e0b967f08a4eb1f9 100644 (file)
@@ -356,13 +356,8 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
                }
                break;
        case IIO_CHAN_INFO_INT_TIME:
-               if (chan->type == IIO_LIGHT) {
-                       if (val) {
-                               mutex_unlock(&chip->lock);
-                               return -EINVAL;
-                       }
+               if (chan->type == IIO_LIGHT && !val)
                        ret = isl29018_set_integration_time(chip, val2);
-               }
                break;
        case IIO_CHAN_INFO_SCALE:
                if (chan->type == IIO_LIGHT)