linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Oleg Drokin <oleg.drokin@intel.com>
Cc: kernel-janitors@vger.kernel.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/11] staging: lustre: fid: Use kzalloc and kfree
Date: Fri,  1 May 2015 17:51:22 +0200	[thread overview]
Message-ID: <1430495482-933-12-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1430495482-933-1-git-send-email-Julia.Lawall@lip6.fr>

From: Julia Lawall <Julia.Lawall@lip6.fr>

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>

---
 drivers/staging/lustre/lustre/fid/fid_request.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -505,11 +505,11 @@ int client_fid_init(struct obd_device *o
 	char *prefix;
 	int rc;
 
-	OBD_ALLOC_PTR(cli->cl_seq);
+	cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS);
 	if (cli->cl_seq == NULL)
 		return -ENOMEM;
 
-	OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
+	prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS);
 	if (prefix == NULL) {
 		rc = -ENOMEM;
 		goto out_free_seq;
@@ -519,13 +519,13 @@ int client_fid_init(struct obd_device *o
 
 	/* Init client side sequence-manager */
 	rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL);
-	OBD_FREE(prefix, MAX_OBD_NAME + 5);
+	kfree(prefix);
 	if (rc)
 		goto out_free_seq;
 
 	return rc;
 out_free_seq:
-	OBD_FREE_PTR(cli->cl_seq);
+	kfree(cli->cl_seq);
 	cli->cl_seq = NULL;
 	return rc;
 }
@@ -537,7 +537,7 @@ int client_fid_fini(struct obd_device *o
 
 	if (cli->cl_seq != NULL) {
 		seq_client_fini(cli->cl_seq);
-		OBD_FREE_PTR(cli->cl_seq);
+		kfree(cli->cl_seq);
 		cli->cl_seq = NULL;
 	}
 


  parent reply	other threads:[~2015-05-01 16:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 15:51 [PATCH 0/11] Use kzalloc and kfree Julia Lawall
2015-05-01 15:51 ` [PATCH 11/11] staging: lustre: ptlrpc: " Julia Lawall
2015-05-01 15:51 ` [PATCH 10/11] staging: lustre: osc: " Julia Lawall
2015-05-01 15:51 ` [PATCH 9/11] staging: lustre: obdecho: " Julia Lawall
2015-05-01 15:51 ` [PATCH 8/11] staging: lustre: obdclass: " Julia Lawall
2015-05-01 18:30   ` walter harms
2015-05-01 18:42     ` Julia Lawall
2015-05-01 15:51 ` [PATCH 7/11] staging: lustre: mgc: " Julia Lawall
2015-05-01 15:51 ` [PATCH 6/11] staging: lustre: mdc: " Julia Lawall
2015-05-01 15:51 ` [PATCH 5/11] staging: lustre: lmv: " Julia Lawall
2015-05-01 15:51 ` [PATCH 4/11] staging: lustre: ldlm: " Julia Lawall
2015-05-01 15:51 ` [PATCH 3/11] staging: lustre: lclient: " Julia Lawall
2015-05-01 15:51 ` [PATCH 2/11] Staging: lustre: fld: " Julia Lawall
2015-05-01 17:38   ` [HPDD-discuss] " Simmons, James A.
2015-05-01 17:48     ` Julia Lawall
2015-05-01 18:49       ` Drokin, Oleg
2015-05-01 20:18       ` Simmons, James A.
2015-05-01 20:47         ` Greg Kroah-Hartman
2015-05-01 22:57           ` Simmons, James A.
2015-05-01 20:49         ` Drokin, Oleg
2015-05-01 22:59           ` Simmons, James A.
2015-05-01 18:05     ` Greg Kroah-Hartman
2015-05-01 20:02     ` Dan Carpenter
2015-05-01 20:12       ` Drokin, Oleg
2015-05-01 20:36       ` Simmons, James A.
2015-05-01 20:49         ` Greg Kroah-Hartman
2015-05-01 20:52           ` Drokin, Oleg
2015-05-01 20:58             ` Greg Kroah-Hartman
2015-05-01 21:13               ` Drokin, Oleg
2015-05-02  6:02                 ` Julia Lawall
2015-05-02  8:14                 ` Dan Carpenter
2015-05-02  9:05                   ` Julia Lawall
2015-05-03  3:12                   ` Drokin, Oleg
2015-05-01 15:51 ` Julia Lawall [this message]
2015-05-03 18:17 ` [PATCH 0/11] " Greg Kroah-Hartman
2015-05-03 18:39   ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430495482-933-12-git-send-email-Julia.Lawall@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).