]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: lustre: lclient: Use kzalloc and kfree
authorJulia Lawall <Julia.Lawall@lip6.fr>
Fri, 1 May 2015 15:51:20 +0000 (17:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 07:23:47 +0000 (09:23 +0200)
Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/lclient/lcommon_cl.c

index ab6cb419302fb2f0cf7cff2c3e9d97b4d8678575..19448fe52cfd8901348d82c9d65df85ae2f7785f 100644 (file)
@@ -202,7 +202,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
        struct cl_site    *site;
        int rc;
 
-       OBD_ALLOC_PTR(vdv);
+       vdv = kzalloc(sizeof(*vdv), GFP_NOFS);
        if (vdv == NULL)
                return ERR_PTR(-ENOMEM);
 
@@ -211,7 +211,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
        ccc2lu_dev(vdv)->ld_ops = luops;
        vdv->cdv_cl.cd_ops = clops;
 
-       OBD_ALLOC_PTR(site);
+       site = kzalloc(sizeof(*site), GFP_NOFS);
        if (site != NULL) {
                rc = cl_site_init(site, &vdv->cdv_cl);
                if (rc == 0)
@@ -219,7 +219,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
                else {
                        LASSERT(lud->ld_site == NULL);
                        CERROR("Cannot init lu_site, rc %d.\n", rc);
-                       OBD_FREE_PTR(site);
+                       kfree(site);
                }
        } else
                rc = -ENOMEM;
@@ -239,10 +239,10 @@ struct lu_device *ccc_device_free(const struct lu_env *env,
 
        if (d->ld_site != NULL) {
                cl_site_fini(site);
-               OBD_FREE_PTR(site);
+               kfree(site);
        }
        cl_device_fini(lu2cl_dev(d));
-       OBD_FREE_PTR(vdv);
+       kfree(vdv);
        return next;
 }