diff options
author | Cristian Stoica <cristian.stoica@freescale.com> | 2014-07-07 04:52:41 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-07-10 04:59:13 -0400 |
commit | 0378c9a855bfa395f595fbfb049707093e270f69 (patch) | |
tree | e6c1e570ee9a333349dbe9dbf99e8965a97d0474 /drivers/crypto | |
parent | cfe82d4f45c7cc39332a2be7c4c1d3bf279bbd3d (diff) |
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: Cristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/jr.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 1d80bd3636c5..b512a4ba7569 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
@@ -453,8 +453,8 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
453 | int error; | 453 | int error; |
454 | 454 | ||
455 | jrdev = &pdev->dev; | 455 | jrdev = &pdev->dev; |
456 | jrpriv = kmalloc(sizeof(struct caam_drv_private_jr), | 456 | jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr), |
457 | GFP_KERNEL); | 457 | GFP_KERNEL); |
458 | if (!jrpriv) | 458 | if (!jrpriv) |
459 | return -ENOMEM; | 459 | return -ENOMEM; |
460 | 460 | ||
@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
487 | 487 | ||
488 | /* Now do the platform independent part */ | 488 | /* Now do the platform independent part */ |
489 | error = caam_jr_init(jrdev); /* now turn on hardware */ | 489 | error = caam_jr_init(jrdev); /* now turn on hardware */ |
490 | if (error) { | 490 | if (error) |
491 | kfree(jrpriv); | ||
492 | return error; | 491 | return error; |
493 | } | ||
494 | 492 | ||
495 | jrpriv->dev = jrdev; | 493 | jrpriv->dev = jrdev; |
496 | spin_lock(&driver_data.jr_alloc_lock); | 494 | spin_lock(&driver_data.jr_alloc_lock); |