public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtip32xx: release the semaphore on an error path
@ 2012-04-16 19:24 Asai Thambi S P
  2012-04-16 19:25 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Asai Thambi S P @ 2012-04-16 19:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Dan Carpenter, linux-kernel@vger.kernel.org, Sam Bradshaw

Release the semaphore in an error path in mtip_hw_get_scatterlist(). This
fixes the smatch warning inconsistent returns.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
---
 drivers/block/mtip32xx/mtip32xx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 00f9fc9..304000c 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2510,8 +2510,10 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd,
 		up(&dd->port->cmd_slot);
 		return NULL;
 	}
-	if (unlikely(*tag < 0))
+	if (unlikely(*tag < 0)) {
+		up(&dd->port->cmd_slot);
 		return NULL;
+	}
 
 	return dd->port->commands[*tag].sg;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtip32xx: release the semaphore on an error path
  2012-04-16 19:24 [PATCH] mtip32xx: release the semaphore on an error path Asai Thambi S P
@ 2012-04-16 19:25 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2012-04-16 19:25 UTC (permalink / raw)
  To: Asai Thambi S P; +Cc: Dan Carpenter, linux-kernel@vger.kernel.org, Sam Bradshaw

On 2012-04-16 21:24, Asai Thambi S P wrote:
> Release the semaphore in an error path in mtip_hw_get_scatterlist(). This
> fixes the smatch warning inconsistent returns.

Thanks Asai, and Dan for the report. Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-16 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-16 19:24 [PATCH] mtip32xx: release the semaphore on an error path Asai Thambi S P
2012-04-16 19:25 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox