[PATCH] staging: iio: light: isl29018: Add missing mutex_unlock on error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes the following warning:

drivers/staging/iio/light/isl29018.c:386 isl29018_write_raw() warn:
inconsistent returns 'mutex:&chip->lock'.
 Locked on:   line 374
 Unlocked on: line 386

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/staging/iio/light/isl29018.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
index 435d417..08ca9a4 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -370,8 +370,10 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
 		break;
 	case IIO_CHAN_INFO_INT_TIME:
 		if (chan->type == IIO_LIGHT)
-			if (val != 0)
+			if (val != 0) {
+				mutex_unlock(&chip->lock);
 				return -EINVAL;
+			}
 			ret = isl29018_set_integration_time(chip, val2);
 		break;
 	case IIO_CHAN_INFO_SCALE:
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux