Commit 528021fc authored by Brian Masney's avatar Brian Masney Committed by Jonathan Cameron

staging: iio: isl29018: made error handling consistent

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: default avatarBrian Masney <masneyb@onstation.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 7fd1accc
...@@ -356,13 +356,8 @@ static int isl29018_write_raw(struct iio_dev *indio_dev, ...@@ -356,13 +356,8 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
} }
break; break;
case IIO_CHAN_INFO_INT_TIME: case IIO_CHAN_INFO_INT_TIME:
if (chan->type == IIO_LIGHT) { if (chan->type == IIO_LIGHT && !val)
if (val) {
mutex_unlock(&chip->lock);
return -EINVAL;
}
ret = isl29018_set_integration_time(chip, val2); ret = isl29018_set_integration_time(chip, val2);
}
break; break;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
if (chan->type == IIO_LIGHT) if (chan->type == IIO_LIGHT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment