Skip to contentSkip to conversation

mfd: twl4030: Fix mismatch in mutex lock-unlock

PATCH Superseded Sanjeev Premi 2 participants 3 messages Jul 8, 2011 – Jul 11, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: twl4030: Fix mismatch in mutex lock-unlock

A mutex is locked on entry into twl4030_madc_conversion(). Immediate return on some error conditions leaves the mutex locked.

This patch ensures that mutex is always unlocked before leaving the function.

---

Compile tested only.

 drivers/mfd/twl4030-madc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/twl4030-madc.c +4 -4
index 3941ddc..b5d598c 100644
@@ -530,13 +530,13 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
 	if (ret) {
 		dev_err(twl4030_madc->dev,
 			"unable to write sel register 0x%X\n", method->sel + 1);
-		return ret;
+		goto out;
 	}
 	ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method->sel);
 	if (ret) {
 		dev_err(twl4030_madc->dev,
 			"unable to write sel register 0x%X\n", method->sel + 1);
-		return ret;
+		goto out;
 	}
 	/* Select averaging for all channels if do_avg is set */
 	if (req->do_avg) {
@@ -546,7 +546,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
 			dev_err(twl4030_madc->dev,
 				"unable to write avg register 0x%X\n",
 				method->avg + 1);
-			return ret;
+			goto out;
 		}
 		ret = twl_i2c_write_u8(TWL4030_MODULE_MADC,
 				       ch_lsb, method->avg);
@@ -554,7 +554,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
 			dev_err(twl4030_madc->dev,
 				"unable to write sel reg 0x%X\n",
 				method->sel + 1);
-			return ret;
+			goto out;
 		}
 	}
 	if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) {
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 21 lines · Sanjeev Premi

A mutex is locked on entry into twl4030_madc_conversion(). Immediate return on some error conditions leaves the mutex locked.

This patch ensures that mutex is always unlocked before leaving the function.

---

Compile tested only.

 drivers/mfd/twl4030-madc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/twl4030-madc.c +0 -0
index 3941ddc..b5d598c 100644

drivers/mfd/twl4030-madc.c

Quoted 1 line
drivers/mfd/twl4030-madc.c +0 -0
(...)

Wrong list. This isn't a hwmon driver, so lm-sensors isn't suitable. scripts/get_maintainer.pl says that you should send this patch to:
Samuel Ortiz <[email protected]>

Thanks,

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
Quoted 26 lines

-----Original Message-----
From: Jean Delvare [mailto:[email protected]]
Sent: Saturday, July 09, 2011 12:21 PM
To: Premi, Sanjeev
Cc: [email protected]; [email protected]
Subject: Re: [lm-sensors] [PATCH] mfd: twl4030: Fix mismatch in mutex lock-unlock

Quoted 17 lines · Sanjeev Premi

A mutex is locked on entry into twl4030_madc_conversion(). Immediate return on some error conditions leaves the mutex locked.

This patch ensures that mutex is always unlocked before leaving the function.

---

Compile tested only.

 drivers/mfd/twl4030-madc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Quoted 9 lines

drivers/mfd/twl4030-madc.c

Quoted 5 lines
drivers/mfd/twl4030-madc.c +0 -0
index 3941ddc..b5d598c 100644
(...)

Wrong list. This isn't a hwmon driver, so lm-sensors isn't suitable. scripts/get_maintainer.pl says that you should send this patch to:
Samuel Ortiz <[email protected]>

[sp] I picked the list from the patch where this functionality was first
introduced. Assumed that Samuel would on this list itself...

sorry for noise :(

~sanjeev

Quoted 5 lines

Thanks,

Signature · 1 line
Jean Delvare