Commit 593901aa authored by Pramod Gurav's avatar Pramod Gurav Committed by Herbert Xu
Browse files

crypto: atmel-sha - Switch to managed version of kzalloc

This patch switches data allocation from kzalloc to devm_kzalloc.
It also removed some kfree() on data that was earlier allocated
using devm_kzalloc().

CC: Herbert Xu <>
CC: "David S. Miller" <>
CC: Grant Likely <>
CC: Rob Herring <>
CC: Nicolas Ferre <>
Signed-off-by: default avatarPramod Gurav <>
Signed-off-by: default avatarHerbert Xu <>
parent 3b9b8fe0
......@@ -1353,7 +1353,6 @@ static struct crypto_platform_data *atmel_sha_of_init(struct platform_device *pd
if (!pdata->dma_slave) {
dev_err(&pdev->dev, "could not allocate memory for dma_slave\n");
devm_kfree(&pdev->dev, pdata);
return ERR_PTR(-ENOMEM);
......@@ -1375,7 +1374,8 @@ static int atmel_sha_probe(struct platform_device *pdev)
unsigned long sha_phys_size;
int err;
sha_dd = kzalloc(sizeof(struct atmel_sha_dev), GFP_KERNEL);
sha_dd = devm_kzalloc(&pdev->dev, sizeof(struct atmel_sha_dev),
if (sha_dd == NULL) {
dev_err(dev, "unable to alloc data struct.\n");
err = -ENOMEM;
......@@ -1490,8 +1490,6 @@ clk_err:
free_irq(sha_dd->irq, sha_dd);
sha_dd = NULL;
dev_err(dev, "initialization failed.\n");
......@@ -1523,9 +1521,6 @@ static int atmel_sha_remove(struct platform_device *pdev)
if (sha_dd->irq >= 0)
free_irq(sha_dd->irq, sha_dd);
sha_dd = NULL;
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment