Skip to content
  • Nadim almas's avatar
    Crypto: mv_cesa - Switch to using managed resources · 650d4a97
    Nadim almas authored
    
    
    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: default avatarNadim Almas <nadim.902@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    650d4a97