[PATCH 5/9] Staging: ipack/bridges/tpci200: remove gotos in tpci200_install()

From: Miguel GÃmez
Date: Thu Jun 07 2012 - 04:26:35 EST


Remove the gotos when handling error conditions, as the code gets clearer
and the gotos are not really avoiding code replication.

Signed-off-by: Miguel GÃmez <magomez@xxxxxxxxxx>
---
drivers/staging/ipack/bridges/tpci200.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 29c91d6..51448c7 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -776,23 +776,18 @@ static int tpci200_install(struct tpci200_board *tpci200)

tpci200->slots = kzalloc(
TPCI200_NB_SLOT * sizeof(struct tpci200_slot), GFP_KERNEL);
- if (tpci200->slots == NULL) {
- res = -ENOMEM;
- goto out_err;
- }
+ if (tpci200->slots == NULL)
+ return -ENOMEM;

res = tpci200_register(tpci200);
- if (res)
- goto out_free;
+ if (res) {
+ kfree(tpci200->slots);
+ tpci200->slots = NULL;
+ return res;
+ }

mutex_init(&tpci200->mutex);
return 0;
-
-out_free:
- kfree(tpci200->slots);
- tpci200->slots = NULL;
-out_err:
- return res;
}

static int tpci200_pciprobe(struct pci_dev *pdev,
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/