Commit 572b7cf0 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Herbert Xu
Browse files

crypto: cavium - Fix an error handling path in cpt_ucode_load_fw()



If do_cpt_init() fails, a previous dma_alloc_coherent() call needs to be
undone.

Add the needed dma_free_coherent() before returning.

Fixes: 9e2c7d99 ("crypto: cavium - Add Support for Octeon-tx CPT Engine")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent dccd5589
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -302,6 +302,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)

	ret = do_cpt_init(cpt, mcode);
	if (ret) {
		dma_free_coherent(&cpt->pdev->dev, mcode->code_size,
				  mcode->code, mcode->phys_base);
		dev_err(dev, "do_cpt_init failed with ret: %d\n", ret);
		goto fw_release;
	}