Crypto: mv_cesa - Switch to using managed resources
Switch to resource-managed function devm_kzalloc instead of kzalloc and remove unneeded kfree Also, remove kfree in probe function and remove function, mv_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression prb.e; @@ removefn(...) { <... - kfree(e); ...> } //</smpl> Signed-off-by: Nadim Almas <nadim.902@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
4d9b3a5b93
commit
650d4a9782
1 changed files with 1 additions and 3 deletions
|
@ -1073,7 +1073,7 @@ static int mv_probe(struct platform_device *pdev)
|
||||||
if (!res)
|
if (!res)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
cp = kzalloc(sizeof(*cp), GFP_KERNEL);
|
cp = devm_kzalloc(&pdev->dev, sizeof(*cp), GFP_KERNEL);
|
||||||
if (!cp)
|
if (!cp)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1163,7 +1163,6 @@ static int mv_probe(struct platform_device *pdev)
|
||||||
err_thread:
|
err_thread:
|
||||||
kthread_stop(cp->queue_th);
|
kthread_stop(cp->queue_th);
|
||||||
err:
|
err:
|
||||||
kfree(cp);
|
|
||||||
cpg = NULL;
|
cpg = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1186,6 @@ static int mv_remove(struct platform_device *pdev)
|
||||||
clk_put(cp->clk);
|
clk_put(cp->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(cp);
|
|
||||||
cpg = NULL;
|
cpg = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue