Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754869AbbEAQAT (ORCPT ); Fri, 1 May 2015 12:00:19 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:25341 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030227AbbEAQAO (ORCPT ); Fri, 1 May 2015 12:00:14 -0400 X-IronPort-AV: E=Sophos;i="5.13,351,1427752800"; d="scan'208";a="114191928" From: Julia Lawall To: Oleg Drokin Cc: kernel-janitors@vger.kernel.org, Andreas Dilger , Greg Kroah-Hartman , 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 Message-Id: <1430495482-933-12-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430495482-933-1-git-send-email-Julia.Lawall@lip6.fr> References: <1430495482-933-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2054 Lines: 72 From: Julia Lawall 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 --- 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; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/