From: Miguel Gómez Date: Thu, 7 Jun 2012 08:24:54 +0000 (+0200) Subject: Staging: ipack/bridges/tpci200: remove gotos in tpci200_install() X-Git-Tag: firefly_0821_release~3680^2~2356^2~890 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ec0ceb9e42ca9d7c65c1cbea585d8f5d61db7b2f;p=firefly-linux-kernel-4.4.55.git Staging: ipack/bridges/tpci200: remove gotos in tpci200_install() 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 7616c4928c96..e692f1e13aa5 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -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,