Skip to content

Commit 572b7cf

Browse files
tititiou36herbertx
authored andcommitted
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: 9e2c7d9 ("crypto: cavium - Add Support for Octeon-tx CPT Engine") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent dccd558 commit 572b7cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/crypto/cavium/cpt/cptpf_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)
302302

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

0 commit comments

Comments
 (0)