Commit e178ccb3 authored by Sanjeev Premi's avatar Sanjeev Premi Committed by Samuel Ortiz

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: default avatarSanjeev Premi <premi@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 2b959e7f
...@@ -530,13 +530,13 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req) ...@@ -530,13 +530,13 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
if (ret) { if (ret) {
dev_err(twl4030_madc->dev, dev_err(twl4030_madc->dev,
"unable to write sel register 0x%X\n", method->sel + 1); "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); ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method->sel);
if (ret) { if (ret) {
dev_err(twl4030_madc->dev, dev_err(twl4030_madc->dev,
"unable to write sel register 0x%X\n", method->sel + 1); "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 */ /* Select averaging for all channels if do_avg is set */
if (req->do_avg) { if (req->do_avg) {
...@@ -546,7 +546,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req) ...@@ -546,7 +546,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
dev_err(twl4030_madc->dev, dev_err(twl4030_madc->dev,
"unable to write avg register 0x%X\n", "unable to write avg register 0x%X\n",
method->avg + 1); method->avg + 1);
return ret; goto out;
} }
ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ret = twl_i2c_write_u8(TWL4030_MODULE_MADC,
ch_lsb, method->avg); ch_lsb, method->avg);
...@@ -554,7 +554,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req) ...@@ -554,7 +554,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
dev_err(twl4030_madc->dev, dev_err(twl4030_madc->dev,
"unable to write sel reg 0x%X\n", "unable to write sel reg 0x%X\n",
method->sel + 1); method->sel + 1);
return ret; goto out;
} }
} }
if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) { if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment