Staging: ipack/bridges/tpci200: remove gotos in tpci200_install()
authorMiguel Gómez <magomez@igalia.com>
Thu, 7 Jun 2012 08:24:54 +0000 (10:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Jun 2012 15:58:03 +0000 (08:58 -0700)
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@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ipack/bridges/tpci200.c

index 7616c4928c96c09774a0774d7f5f676f8a079037..e692f1e13aa55461b40303b80990b98403235498 100644 (file)
@@ -777,23 +777,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,