Explorar o código

crypto: mv_cesa - fixup error handling in mv_probe()

The error handling in mv_probe() was a bit messed up.  There were some 
gotos to the wrong labels so it ended up releasing stuff that that hadn't
been aquired and not releasing stuff that was meant to be released.  I
shuffled it around a bit to fix it and make it clearer.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Dan Carpenter %!s(int64=15) %!d(string=hai) anos
pai
achega
7cc2835083
Modificáronse 1 ficheiros con 5 adicións e 5 borrados
  1. 5 5
      drivers/crypto/mv_cesa.c

+ 5 - 5
drivers/crypto/mv_cesa.c

@@ -1055,20 +1055,20 @@ static int mv_probe(struct platform_device *pdev)
 	cp->queue_th = kthread_run(queue_manag, cp, "mv_crypto");
 	cp->queue_th = kthread_run(queue_manag, cp, "mv_crypto");
 	if (IS_ERR(cp->queue_th)) {
 	if (IS_ERR(cp->queue_th)) {
 		ret = PTR_ERR(cp->queue_th);
 		ret = PTR_ERR(cp->queue_th);
-		goto err_thread;
+		goto err_unmap_sram;
 	}
 	}
 
 
 	ret = request_irq(irq, crypto_int, IRQF_DISABLED, dev_name(&pdev->dev),
 	ret = request_irq(irq, crypto_int, IRQF_DISABLED, dev_name(&pdev->dev),
 			cp);
 			cp);
 	if (ret)
 	if (ret)
-		goto err_unmap_sram;
+		goto err_thread;
 
 
 	writel(SEC_INT_ACCEL0_DONE, cpg->reg + SEC_ACCEL_INT_MASK);
 	writel(SEC_INT_ACCEL0_DONE, cpg->reg + SEC_ACCEL_INT_MASK);
 	writel(SEC_CFG_STOP_DIG_ERR, cpg->reg + SEC_ACCEL_CFG);
 	writel(SEC_CFG_STOP_DIG_ERR, cpg->reg + SEC_ACCEL_CFG);
 
 
 	ret = crypto_register_alg(&mv_aes_alg_ecb);
 	ret = crypto_register_alg(&mv_aes_alg_ecb);
 	if (ret)
 	if (ret)
-		goto err_reg;
+		goto err_irq;
 
 
 	ret = crypto_register_alg(&mv_aes_alg_cbc);
 	ret = crypto_register_alg(&mv_aes_alg_cbc);
 	if (ret)
 	if (ret)
@@ -1091,9 +1091,9 @@ static int mv_probe(struct platform_device *pdev)
 	return 0;
 	return 0;
 err_unreg_ecb:
 err_unreg_ecb:
 	crypto_unregister_alg(&mv_aes_alg_ecb);
 	crypto_unregister_alg(&mv_aes_alg_ecb);
-err_thread:
+err_irq:
 	free_irq(irq, cp);
 	free_irq(irq, cp);
-err_reg:
+err_thread:
 	kthread_stop(cp->queue_th);
 	kthread_stop(cp->queue_th);
 err_unmap_sram:
 err_unmap_sram:
 	iounmap(cp->sram);
 	iounmap(cp->sram);