From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422670AbbEAQH2 (ORCPT ); Fri, 1 May 2015 12:07:28 -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 S1754575AbbEAP77 (ORCPT ); Fri, 1 May 2015 11:59:59 -0400 X-IronPort-AV: E=Sophos;i="5.13,351,1427752800"; d="scan'208";a="114191916" From: Julia Lawall To: linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, devel@driverdev.osuosl.org, HPDD-discuss@ml01.01.org, Greg Kroah-Hartman , Andreas Dilger , Oleg Drokin Subject: [PATCH 0/11] Use kzalloc and kfree Date: Fri, 1 May 2015 17:51:11 +0200 Message-Id: <1430495482-933-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The complete semantic patch that makes these changes is as follows: (http://coccinelle.lip6.fr/) // @@ expression ptr,e1,e2; @@ - OBD_ALLOC(ptr,sizeof e1 * e2) + ptr = kcalloc(e2, sizeof e1, GFP_NOFS) @@ expression ptr,e1,e2; @@ - OBD_ALLOC_WAIT(ptr,sizeof e1 * e2) + ptr = kcalloc(sizeof e1, e2, GFP_KERNEL) @@ expression ptr,e1,e2; @@ - OBD_ALLOC(ptr,e2 * sizeof e1) + ptr = kcalloc(e2, sizeof e1, GFP_NOFS) @@ expression ptr,e1,e2; @@ - OBD_ALLOC_WAIT(ptr,e2 * sizeof e1) + ptr = kcalloc(e2, sizeof e1, GFP_KERNEL) @@ expression ptr,e2; type t; @@ - OBD_ALLOC(ptr,sizeof (t) * e2) + ptr = kcalloc(e2, sizeof (t), GFP_NOFS) @@ expression ptr,e2; type t; @@ - OBD_ALLOC_WAIT(ptr,sizeof (t) * e2) + ptr = kcalloc(e2, sizeof (t), GFP_KERNEL) @@ expression ptr,e2; type t; @@ - OBD_ALLOC(ptr,e2 * sizeof (t)) + ptr = kcalloc(e2, sizeof (t), GFP_NOFS) @@ expression ptr,e2; type t; @@ - OBD_ALLOC_WAIT(ptr,e2 * sizeof (t)) + ptr = kcalloc(e2, sizeof (t), GFP_KERNEL) @@ expression ptr,e1,e2; @@ - OBD_ALLOC(ptr,e1 * e2) + ptr = kcalloc(e1, e2, GFP_NOFS) @@ expression ptr,e1,e2; @@ - OBD_ALLOC_WAIT(ptr,e1 * e2) + ptr = kcalloc(e1, e2, GFP_KERNEL) // ----------------------------------------------------------------------- @@ expression ptr,size; @@ - OBD_ALLOC(ptr,size) + ptr = kzalloc(size, GFP_NOFS) @@ expression ptr,size; @@ - OBD_ALLOC_WAIT(ptr,size) + ptr = kzalloc(size, GFP_KERNEL) @@ expression ptr; @@ - OBD_ALLOC_PTR(ptr) + ptr = kzalloc(sizeof(*ptr), GFP_NOFS) @@ expression ptr; @@ - OBD_ALLOC_PTR_WAIT(ptr) + ptr = kzalloc(sizeof(*ptr), GFP_KERNEL) // ---------------------------------------------------------------------- @@ expression ptr, size; @@ - OBD_FREE(ptr, size); + kfree(ptr); @@ expression ptr; @@ - OBD_FREE_PTR(ptr); + kfree(ptr); //