crypto: atmel - Free memory in error path

If only one of the 2 __get_free_pages fails, then there is a memory leak.

Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Christophe Jaillet 2015-01-20 08:15:52 +01:00 committed by Herbert Xu
parent 379dcfb406
commit 088f628cc0
2 changed files with 2 additions and 2 deletions

View File

@ -673,9 +673,9 @@ static int atmel_aes_buff_init(struct atmel_aes_dev *dd)
dma_unmap_single(dd->dev, dd->dma_addr_in, dd->buflen,
DMA_TO_DEVICE);
err_map_in:
err_alloc:
free_page((unsigned long)dd->buf_out);
free_page((unsigned long)dd->buf_in);
err_alloc:
if (err)
pr_err("error: %d\n", err);
return err;

View File

@ -376,9 +376,9 @@ static int atmel_tdes_buff_init(struct atmel_tdes_dev *dd)
dma_unmap_single(dd->dev, dd->dma_addr_in, dd->buflen,
DMA_TO_DEVICE);
err_map_in:
err_alloc:
free_page((unsigned long)dd->buf_out);
free_page((unsigned long)dd->buf_in);
err_alloc:
if (err)
pr_err("error: %d\n", err);
return err;