From: Brian Masney Date: Tue, 27 Sep 2016 00:20:19 +0000 (-0400) Subject: staging: iio: isl29018: change isl29018_read_raw() to only have one exit point X-Git-Tag: v4.10-rc1~148^2~508^2~89 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5611cd6fc61dbccdba61656bea9c5c1634b51e46;p=karo-tx-linux.git staging: iio: isl29018: change isl29018_read_raw() to only have one exit point 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 Signed-off-by: Jonathan Cameron --- diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 990c6e52bafe..3a4d79d7e23c 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; }