All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-arm-kernel@lists.infradead.org
Subject: [patch] bus: sunxi-rsb: unlock on error in sunxi_rsb_read()
Date: Tue, 03 Nov 2015 22:02:44 +0000	[thread overview]
Message-ID: <20151103220244.GA19280@mwanda> (raw)

Don't forget to unlock before returning an error code.

Fixes: d787dcdb9c8f ('bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 846bc29c..0cfcb39 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -342,13 +342,13 @@ static int sunxi_rsb_read(struct sunxi_rsb *rsb, u8 rtaddr, u8 addr,
 
 	ret = _sunxi_rsb_run_xfer(rsb);
 	if (ret)
-		goto out;
+		goto unlock;
 
 	*buf = readl(rsb->regs + RSB_DATA);
 
+unlock:
 	mutex_unlock(&rsb->lock);
 
-out:
 	return ret;
 }
 

WARNING: multiple messages have this Message-ID (diff)
From: dan.carpenter@oracle.com (Dan Carpenter)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch] bus: sunxi-rsb: unlock on error in sunxi_rsb_read()
Date: Wed, 4 Nov 2015 01:02:44 +0300	[thread overview]
Message-ID: <20151103220244.GA19280@mwanda> (raw)

Don't forget to unlock before returning an error code.

Fixes: d787dcdb9c8f ('bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 846bc29c..0cfcb39 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -342,13 +342,13 @@ static int sunxi_rsb_read(struct sunxi_rsb *rsb, u8 rtaddr, u8 addr,
 
 	ret = _sunxi_rsb_run_xfer(rsb);
 	if (ret)
-		goto out;
+		goto unlock;
 
 	*buf = readl(rsb->regs + RSB_DATA);
 
+unlock:
 	mutex_unlock(&rsb->lock);
 
-out:
 	return ret;
 }
 

             reply	other threads:[~2015-11-03 22:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 22:02 Dan Carpenter [this message]
2015-11-03 22:02 ` [patch] bus: sunxi-rsb: unlock on error in sunxi_rsb_read() Dan Carpenter
2015-11-04 12:19 ` walter harms
2015-11-04 12:19   ` walter harms
2015-11-04 12:34   ` Julia Lawall
2015-11-04 12:34     ` Julia Lawall
2015-11-04 12:46   ` Dan Carpenter
2015-11-04 12:46     ` Dan Carpenter
2015-11-04 15:28 ` Chen-Yu Tsai
2015-11-04 15:28   ` Chen-Yu Tsai
2015-11-04 15:51 ` Maxime Ripard
2015-11-04 15:51   ` Maxime Ripard
2015-11-04 21:22 ` walter harms
2015-11-05  6:07 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151103220244.GA19280@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.