Skip to content

Commit

Permalink
crypto: ccree - use devm_kzalloc for device data
Browse files Browse the repository at this point in the history
Move some remaining device data allocation to the safer devm_*
interface.

Signed-off-by: Gilad Ben-Yossef <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
gby authored and herbertx committed Apr 25, 2019
1 parent d574b70 commit dcb2cf1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions drivers/crypto/ccree/cc_fips.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ void cc_fips_fini(struct cc_drvdata *drvdata)

/* Kill tasklet */
tasklet_kill(&fips_h->tasklet);

kfree(fips_h);
drvdata->fips_handle = NULL;
}

Expand Down Expand Up @@ -104,7 +102,7 @@ int cc_fips_init(struct cc_drvdata *p_drvdata)
if (p_drvdata->hw_rev < CC_HW_REV_712)
return 0;

fips_h = kzalloc(sizeof(*fips_h), GFP_KERNEL);
fips_h = devm_kzalloc(dev, sizeof(*fips_h), GFP_KERNEL);
if (!fips_h)
return -ENOMEM;

Expand Down
5 changes: 2 additions & 3 deletions drivers/crypto/ccree/cc_sram_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ struct cc_sram_ctx {
*/
void cc_sram_mgr_fini(struct cc_drvdata *drvdata)
{
/* Free "this" context */
kfree(drvdata->sram_mgr_handle);
/* Nothing needed */
}

/**
Expand Down Expand Up @@ -48,7 +47,7 @@ int cc_sram_mgr_init(struct cc_drvdata *drvdata)
}

/* Allocate "this" context */
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);

if (!ctx)
return -ENOMEM;
Expand Down

0 comments on commit dcb2cf1

Please sign in to comment.