* [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock
@ 2011-07-11 15:20 Sanjeev Premi
2011-07-11 17:03 ` J, KEERTHY
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sanjeev Premi @ 2011-07-11 15:20 UTC (permalink / raw)
To: linux-omap; +Cc: Sanjeev Premi, Keerthy, Samuel Ortiz
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.
Signed-off-by: Sanjeev Premi <premi@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
---
Compile tested only.
Changes since v1:
None. Repost after adding Samuel Ortiz to cc: and
removed lm-sensors list from to: list.
drivers/mfd/twl4030-madc.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 3941ddc..b5d598c 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -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) {
--
1.7.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock
2011-07-11 15:20 [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock Sanjeev Premi
@ 2011-07-11 17:03 ` J, KEERTHY
2011-07-21 10:44 ` Premi, Sanjeev
2011-07-27 10:55 ` Samuel Ortiz
2 siblings, 0 replies; 4+ messages in thread
From: J, KEERTHY @ 2011-07-11 17:03 UTC (permalink / raw)
To: Sanjeev Premi; +Cc: linux-omap, Samuel Ortiz
Hi Sanjeev,
Thanks. Changes look good to me.
On Mon, Jul 11, 2011 at 8:50 PM, Sanjeev Premi <premi@ti.com> wrote:
> 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.
>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> ---
>
> Compile tested only.
>
> Changes since v1:
> None. Repost after adding Samuel Ortiz to cc: and
> removed lm-sensors list from to: list.
>
> drivers/mfd/twl4030-madc.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
> index 3941ddc..b5d598c 100644
> --- a/drivers/mfd/twl4030-madc.c
> +++ b/drivers/mfd/twl4030-madc.c
> @@ -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) {
> --
> 1.7.2.2
>
>
--
Regards and Thanks,
Keerthy
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock
2011-07-11 15:20 [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock Sanjeev Premi
2011-07-11 17:03 ` J, KEERTHY
@ 2011-07-21 10:44 ` Premi, Sanjeev
2011-07-27 10:55 ` Samuel Ortiz
2 siblings, 0 replies; 4+ messages in thread
From: Premi, Sanjeev @ 2011-07-21 10:44 UTC (permalink / raw)
To: Samuel Ortiz, J, KEERTHY; +Cc: linux-omap
> -----Original Message-----
> From: Premi, Sanjeev
> Sent: Monday, July 11, 2011 8:51 PM
> To: linux-omap@vger.kernel.org
> Cc: Premi, Sanjeev; J, KEERTHY; Samuel Ortiz
> Subject: [PATCHv2] 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.
>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
Samuel, Keerthy,
Just wanted to ping both of you on this patch.
~sanjeev
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock
2011-07-11 15:20 [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock Sanjeev Premi
2011-07-11 17:03 ` J, KEERTHY
2011-07-21 10:44 ` Premi, Sanjeev
@ 2011-07-27 10:55 ` Samuel Ortiz
2 siblings, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2011-07-27 10:55 UTC (permalink / raw)
To: Sanjeev Premi; +Cc: linux-omap, Keerthy
Hi Premi,
On Mon, Jul 11, 2011 at 08:50:31PM +0530, Sanjeev Premi wrote:
> 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.
Patch applied, many thanks.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-27 10:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 15:20 [PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock Sanjeev Premi
2011-07-11 17:03 ` J, KEERTHY
2011-07-21 10:44 ` Premi, Sanjeev
2011-07-27 10:55 ` Samuel Ortiz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.