Skip to content

Commit

Permalink
crypto: caam - fix memleak in caam_jr module
Browse files Browse the repository at this point in the history
This patch fixes a memory leak that appears when caam_jr module is unloaded.

Cc: <stable@vger.kernel.org> # 3.13+
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Cristian Stoica authored and Herbert Xu committed Jul 10, 2014
1 parent cfe82d4 commit 0378c9a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/crypto/caam/jr.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ static int caam_jr_probe(struct platform_device *pdev)
int error;

jrdev = &pdev->dev;
jrpriv = kmalloc(sizeof(struct caam_drv_private_jr),
GFP_KERNEL);
jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr),
GFP_KERNEL);
if (!jrpriv)
return -ENOMEM;

Expand Down Expand Up @@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev)

/* Now do the platform independent part */
error = caam_jr_init(jrdev); /* now turn on hardware */
if (error) {
kfree(jrpriv);
if (error)
return error;
}

jrpriv->dev = jrdev;
spin_lock(&driver_data.jr_alloc_lock);
Expand Down

0 comments on commit 0378c9a

Please sign in to comment.