Skip to content

Commit 0378c9a

Browse files
Cristian Stoicaherbertx
authored andcommitted
crypto: caam - fix memleak in caam_jr module
This patch fixes a memory leak that appears when caam_jr module is unloaded. Cc: <[email protected]> # 3.13+ Signed-off-by: Cristian Stoica <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent cfe82d4 commit 0378c9a

File tree

1 file changed

+3
-5
lines changed
  • drivers/crypto/caam

1 file changed

+3
-5
lines changed

drivers/crypto/caam/jr.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ static int caam_jr_probe(struct platform_device *pdev)
453453
int error;
454454

455455
jrdev = &pdev->dev;
456-
jrpriv = kmalloc(sizeof(struct caam_drv_private_jr),
457-
GFP_KERNEL);
456+
jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr),
457+
GFP_KERNEL);
458458
if (!jrpriv)
459459
return -ENOMEM;
460460

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

488488
/* Now do the platform independent part */
489489
error = caam_jr_init(jrdev); /* now turn on hardware */
490-
if (error) {
491-
kfree(jrpriv);
490+
if (error)
492491
return error;
493-
}
494492

495493
jrpriv->dev = jrdev;
496494
spin_lock(&driver_data.jr_alloc_lock);

0 commit comments

Comments
 (0)