[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1327649890.12089.20.camel@joe2Laptop>
Date: Thu, 26 Jan 2012 23:38:10 -0800
From: Joe Perches <joe@...ches.com>
To: Ryan Mallon <rmallon@...il.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Jiri Kosina <trivial@...nel.org>,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH next V2] drivers: Use NULL not zero pointer assignments
On Fri, 2012-01-27 at 17:20 +1100, Ryan Mallon wrote:
> On 27/01/12 16:33, Joe Perches wrote:
> > Using NULL pointer assignments is more kernel-style standard.
> > Uncompiled, untested.
> > Done via cocinelle script:
> > @@
> > type T;
> > T *pointer;
> > @@
> > -pointer = 0
> > +pointer = NULL
> Hi Joe,
Hi Ryan.
> I think you can drop a lot of the initialisations completely rather than
> convert them. I've pointed some out below. I'm just scanning through for
> likely candidates and I didn't bother looking at the staging drivers, so
> this list is not comprehensive.
I'll try a more generic solution.
Here's a possible cocci script that looks for declarations with
initializations that are later overwritten.
$ cat multi_set.cocci
@@
type T;
identifier x;
expression y;
expression z;
@@
-T x = y;
+T x;
...
x = z
$
This script has a defect because expression z may
use identifier x.
Anyway, if the script can be tweaked appropriately,
it might be useful to remove these unnecessary
initializations.
cheers, Joe
--
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