Skip to contentSkip to conversation

staging: iio: light: isl29018: Add missing mutex_unlock on error path

PATCH In review Roberta Dobrescu 2 participants 2 messages Apr 28, 2015 – Apr 30, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: light: isl29018: Add missing mutex_unlock on error path

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

---
 drivers/staging/iio/light/isl29018.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/iio/light/isl29018.c +3 -1
index 435d417..08ca9a4 100644
@@ -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:
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 9 lines · Roberta Dobrescu

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

I applied this as a fixup rather than a separate patch.

Anyhow, new testing and togreg branches should have this fixed.

Quoted 21 lines
---
 drivers/staging/iio/light/isl29018.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/iio/light/isl29018.c +3 -1
index 435d417..08ca9a4 100644
@@ -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: