Commit 0378c9a8 authored by Cristian Stoica's avatar Cristian Stoica Committed by Herbert Xu

crypto: caam - fix memleak in caam_jr module

This patch fixes a memory leak that appears when caam_jr module is unloaded.

Cc: <stable@vger.kernel.org> # 3.13+
Signed-off-by: default avatarCristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent cfe82d4f
...@@ -453,7 +453,7 @@ static int caam_jr_probe(struct platform_device *pdev) ...@@ -453,7 +453,7 @@ static int caam_jr_probe(struct platform_device *pdev)
int error; int error;
jrdev = &pdev->dev; jrdev = &pdev->dev;
jrpriv = kmalloc(sizeof(struct caam_drv_private_jr), jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr),
GFP_KERNEL); GFP_KERNEL);
if (!jrpriv) if (!jrpriv)
return -ENOMEM; return -ENOMEM;
...@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev) ...@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev)
/* Now do the platform independent part */ /* Now do the platform independent part */
error = caam_jr_init(jrdev); /* now turn on hardware */ error = caam_jr_init(jrdev); /* now turn on hardware */
if (error) { if (error)
kfree(jrpriv);
return error; return error;
}
jrpriv->dev = jrdev; jrpriv->dev = jrdev;
spin_lock(&driver_data.jr_alloc_lock); spin_lock(&driver_data.jr_alloc_lock);
......
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