[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1411071842-24714-1-git-send-email-Julia.Lawall@lip6.fr>
Date: Thu, 18 Sep 2014 22:24:01 +0200
From: Julia Lawall <Julia.Lawall@...6.fr>
To: linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, devel@...verdev.osuosl.org,
HPDD-discuss@...ts.01.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andreas Dilger <andreas.dilger@...el.com>,
Oleg Drokin <oleg.drokin@...el.com>
Subject: [PATCH] Use kzalloc and rewrite null tests
The following patch removes some kzalloc-related macros and rewrites the
associated null tests to use !x rather than x == NULL. The complete
semantic patch used for this transformation is as follows:
// <smpl>
@disable unlikely@
expression ptr;
statement S,S1;
@@
\(OBD_ALLOC\|OBD_ALLOC_WAIT\|OBD_ALLOC_PTR\|OBD_ALLOC_PTR_WAIT\)(ptr,...);
if (unlikely(
+ !
ptr
- == NULL
)) S else S1
@@
expression ptr;
statement S,S1;
@@
\(OBD_ALLOC\|OBD_ALLOC_WAIT\|OBD_ALLOC_PTR\|OBD_ALLOC_PTR_WAIT\)(ptr,...);
if (
+ !
ptr
- == NULL
) S else S1
@disable unlikely@
expression ptr;
statement S,S1;
@@
\(OBD_ALLOC\|OBD_ALLOC_WAIT\|OBD_ALLOC_PTR\|OBD_ALLOC_PTR_WAIT\)(ptr,...);
if (likely(
ptr
- != NULL
)) S else S1
@@
expression ptr;
statement S,S1;
@@
\(OBD_ALLOC\|OBD_ALLOC_WAIT\|OBD_ALLOC_PTR\|OBD_ALLOC_PTR_WAIT\)(ptr,...);
if (
ptr
- != NULL
) S else S1
// -----------------------------------------------------------------------
@@
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,size;
@@
- OBD_ALLOC_PTR(ptr)
+ ptr = kzalloc(sizeof(*ptr), GFP_NOFS)
@@
expression ptr,size;
@@
- OBD_ALLOC_PTR_WAIT(ptr,size)
+ ptr = kzalloc(sizeof(*ptr), GFP_KERNEL)
// </smpl>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists