From d7279044d819842e465c53b5e25630d67ac49bf8 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 1 May 2015 17:51:15 +0200 Subject: staging: lustre: obdclass: Use kzalloc and kfree 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/) // @@ expression ptr,size; @@ - OBD_ALLOC(ptr,size) + ptr = kzalloc(size, GFP_NOFS) @@ expression ptr, size; @@ - OBD_FREE(ptr, size); + kfree(ptr); // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_io.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/staging/lustre/lustre/obdclass/cl_io.c') diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index 3141b6043708..fd1a4c5421e8 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -612,7 +612,7 @@ EXPORT_SYMBOL(cl_io_lock_add); static void cl_free_io_lock_link(const struct lu_env *env, struct cl_io_lock_link *link) { - OBD_FREE_PTR(link); + kfree(link); } /** @@ -624,7 +624,7 @@ int cl_io_lock_alloc_add(const struct lu_env *env, struct cl_io *io, struct cl_io_lock_link *link; int result; - OBD_ALLOC_PTR(link); + link = kzalloc(sizeof(*link), GFP_NOFS); if (link != NULL) { link->cill_descr = *descr; link->cill_fini = cl_free_io_lock_link; @@ -1387,9 +1387,9 @@ static void cl_req_free(const struct lu_env *env, struct cl_req *req) cl_object_put(env, obj); } } - OBD_FREE(req->crq_o, req->crq_nrobjs * sizeof(req->crq_o[0])); + kfree(req->crq_o); } - OBD_FREE_PTR(req); + kfree(req); } static int cl_req_init(const struct lu_env *env, struct cl_req *req, @@ -1448,7 +1448,7 @@ struct cl_req *cl_req_alloc(const struct lu_env *env, struct cl_page *page, LINVRNT(nr_objects > 0); - OBD_ALLOC_PTR(req); + req = kzalloc(sizeof(*req), GFP_NOFS); if (req != NULL) { int result; @@ -1456,7 +1456,8 @@ struct cl_req *cl_req_alloc(const struct lu_env *env, struct cl_page *page, INIT_LIST_HEAD(&req->crq_pages); INIT_LIST_HEAD(&req->crq_layers); - OBD_ALLOC(req->crq_o, nr_objects * sizeof(req->crq_o[0])); + req->crq_o = kcalloc(nr_objects, sizeof(req->crq_o[0]), + GFP_NOFS); if (req->crq_o != NULL) { req->crq_nrobjs = nr_objects; result = cl_req_init(env, req, page); -- cgit v1.2.3-59-g8ed1b