diff mbox

i2c: qup: disable clks and return instead of just returning error

Message ID 1407328405-25170-1-git-send-email-pramod.gurav@smartplayin.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Pramod Gurav Aug. 6, 2014, 12:33 p.m. UTC
This fixes a error handling scenario where clocks were not being disabled
when QUP_OUTPUT_BLOCK_SIZE returns a size greater than the size of blk_sizes
array. So this patch adds a statement to jump to the fail lable to release the
clocks.

CC: Wolfram Sang <wsa@the-dreams.de>
CC: Grant Likely <grant.likely@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: Andy Gross <agross@codeaurora.org>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---

Resending the patch by updating CCs list.
Fixed Typos in commit message noticed by Christopher.

 drivers/i2c/busses/i2c-qup.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Wolfram Sang Aug. 9, 2014, 7:32 p.m. UTC | #1
(Ooops, this mail got somehow into my postponed folder. Sending
anyhow...)

On Wed, Aug 06, 2014 at 06:03:25PM +0530, Pramod Gurav wrote:
> This fixes a error handling scenario where clocks were not being disabled
> when QUP_OUTPUT_BLOCK_SIZE returns a size greater than the size of blk_sizes
> array. So this patch adds a statement to jump to the fail lable to release the
> clocks.
> 
> CC: Wolfram Sang <wsa@the-dreams.de>
> CC: Grant Likely <grant.likely@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> CC: Andy Gross <agross@codeaurora.org>
> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

Applied to for-next with Ivan's ack from V2, thanks!

Please use "[PATCH V3]" and alike in the future to make it more obvious
which version is the most recent.
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 2a5efb5..3a4d64e 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -633,13 +633,17 @@  static int qup_i2c_probe(struct platform_device *pdev)
 	 * associated with each byte written/received
 	 */
 	size = QUP_OUTPUT_BLOCK_SIZE(io_mode);
-	if (size >= ARRAY_SIZE(blk_sizes))
-		return -EIO;
+	if (size >= ARRAY_SIZE(blk_sizes)) {
+		ret = -EIO;
+		goto fail;
+	}
 	qup->out_blk_sz = blk_sizes[size] / 2;
 
 	size = QUP_INPUT_BLOCK_SIZE(io_mode);
-	if (size >= ARRAY_SIZE(blk_sizes))
-		return -EIO;
+	if (size >= ARRAY_SIZE(blk_sizes)) {
+		ret = -EIO;
+		goto fail;
+	}
 	qup->in_blk_sz = blk_sizes[size] / 2;
 
 	size = QUP_OUTPUT_FIFO_SIZE(io_mode);