aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorSanjeev Premi <premi@ti.com>2011-07-11 11:20:31 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-07-31 17:28:27 -0400
commite178ccb33569da17dc897a08a3865441b813bdfb (patch)
treeb5d0fffe561eea9ef9b0646804ef0013c533fd69 /drivers/mfd
parent2b959e7f87491453f3220bb8ab11da7ccb7f6515 (diff)
mfd: Fix mismatch in twl4030 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> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/twl4030-madc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 3941ddcf15fe..b5d598c3aa71 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)
530 if (ret) { 530 if (ret) {
531 dev_err(twl4030_madc->dev, 531 dev_err(twl4030_madc->dev,
532 "unable to write sel register 0x%X\n", method->sel + 1); 532 "unable to write sel register 0x%X\n", method->sel + 1);
533 return ret; 533 goto out;
534 } 534 }
535 ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method->sel); 535 ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method->sel);
536 if (ret) { 536 if (ret) {
537 dev_err(twl4030_madc->dev, 537 dev_err(twl4030_madc->dev,
538 "unable to write sel register 0x%X\n", method->sel + 1); 538 "unable to write sel register 0x%X\n", method->sel + 1);
539 return ret; 539 goto out;
540 } 540 }
541 /* Select averaging for all channels if do_avg is set */ 541 /* Select averaging for all channels if do_avg is set */
542 if (req->do_avg) { 542 if (req->do_avg) {
@@ -546,7 +546,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
546 dev_err(twl4030_madc->dev, 546 dev_err(twl4030_madc->dev,
547 "unable to write avg register 0x%X\n", 547 "unable to write avg register 0x%X\n",
548 method->avg + 1); 548 method->avg + 1);
549 return ret; 549 goto out;
550 } 550 }
551 ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, 551 ret = twl_i2c_write_u8(TWL4030_MODULE_MADC,
552 ch_lsb, method->avg); 552 ch_lsb, method->avg);
@@ -554,7 +554,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
554 dev_err(twl4030_madc->dev, 554 dev_err(twl4030_madc->dev,
555 "unable to write sel reg 0x%X\n", 555 "unable to write sel reg 0x%X\n",
556 method->sel + 1); 556 method->sel + 1);
557 return ret; 557 goto out;
558 } 558 }
559 } 559 }
560 if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) { 560 if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) {