public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] Staging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq().
@ 2012-06-07  8:24 Miguel Gómez
  2012-06-07  8:24 ` [PATCH 2/9] Staging: ipack/bridges/tpci200: remove "out" label in tpci200_slot_map_space() Miguel Gómez
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Miguel Gómez @ 2012-06-07  8:24 UTC (permalink / raw)
  To: gregkh, siglesias, dan.carpenter; +Cc: devel, linux-kernel, Miguel Gómez

Handle error conditions with simple returns instead of usig gotos.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/ipack/bridges/tpci200.c |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index c39499a..31f6b5d 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -512,24 +512,19 @@ static void __tpci200_free_irq(struct tpci200_board *tpci200,
 
 static int tpci200_free_irq(struct ipack_device *dev)
 {
-	int res;
 	struct slot_irq *slot_irq;
 	struct tpci200_board *tpci200;
 
 	tpci200 = check_slot(dev);
-	if (tpci200 == NULL) {
-		res = -EINVAL;
-		goto out;
-	}
+	if (tpci200 == NULL)
+		return -EINVAL;
 
-	if (mutex_lock_interruptible(&tpci200->mutex)) {
-		res = -ERESTARTSYS;
-		goto out;
-	}
+	if (mutex_lock_interruptible(&tpci200->mutex))
+		return -ERESTARTSYS;
 
 	if (tpci200->slots[dev->slot].irq == NULL) {
-		res = -EINVAL;
-		goto out_unlock;
+		mutex_unlock(&tpci200->mutex);
+		return -EINVAL;
 	}
 
 	__tpci200_free_irq(tpci200, dev);
@@ -537,10 +532,7 @@ static int tpci200_free_irq(struct ipack_device *dev)
 	tpci200->slots[dev->slot].irq = NULL;
 	kfree(slot_irq);
 
-out_unlock:
-	mutex_unlock(&tpci200->mutex);
-out:
-	return res;
+	return 0;
 }
 
 static int tpci200_slot_unmap_space(struct ipack_device *dev, int space)
-- 
1.7.9.5


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

end of thread, other threads:[~2012-06-07  9:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-07  8:24 [PATCH 1/9] Staging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq() Miguel Gómez
2012-06-07  8:24 ` [PATCH 2/9] Staging: ipack/bridges/tpci200: remove "out" label in tpci200_slot_map_space() Miguel Gómez
2012-06-07  8:24 ` [PATCH 3/9] Staging: ipack/bridges/tpci200: remove useless break " Miguel Gómez
2012-06-07  8:24 ` [PATCH 4/9] Staging: ipack/bridges/tpci200: remove "out" label in tpci200_request_irq() Miguel Gómez
2012-06-07  8:24 ` [PATCH 5/9] Staging: ipack/bridges/tpci200: remove gotos in tpci200_install() Miguel Gómez
2012-06-07  8:24 ` [PATCH 6/9] Staging: ipack/devices/ipoctal: remove ipoctal_config structure Miguel Gómez
2012-06-07  8:24 ` [PATCH 7/9] Staging: ipack/devices/ipoctal: remove error_flag field from ipoctal struct Miguel Gómez
2012-06-07  8:24 ` [PATCH 8/9] Staging: ipack/devices/ipoctal: remove unused enum uart_parity_e Miguel Gómez
2012-06-07  8:24 ` [PATCH 9/9] Staging: ipack/bridges/tpci200: change device table definition and export it Miguel Gómez
2012-06-07  8:39 ` [PATCH 1/9] Staging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq() Dan Carpenter
2012-06-07  9:10 ` [PATCH v2 " Miguel Gómez

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