[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1403567322.20657.14.camel@joe-AO725>
Date: Mon, 23 Jun 2014 16:48:42 -0700
From: Joe Perches <joe@...ches.com>
To: Julian Calaby <julian.calaby@...il.com>,
Julia Lawall <julia.lawall@...6.fr>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 00/22] Add and use pci_zalloc_consistent
(Adding Julia Lawall and removing almost all other cc's)
On Tue, 2014-06-24 at 09:27 +1000, Julian Calaby wrote:
> Hi Joe,
Hello Julian.
> > $ cat ./scripts/coccinelle/api/alloc/pci_zalloc_consistent.cocci
> > ///
> > /// Use pci_zalloc_consistent rather than
> > /// pci_alloc_consistent followed by memset with 0
> > ///
> > /// This considers some simple cases that are common and easy to validate
> > /// Note in particular that there are no ...s in the rule, so all of the
> > /// matched code has to be contiguous
> > ///
> > /// Blatantly cribbed from: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> >
> > @@
> > type T, T2;
> > expression x;
> > expression E1,E2,E3;
> > statement S;
> > @@
> >
> > - x = (T)pci_alloc_consistent(E1,E2,E3);
> > + x = pci_zalloc_consistent(E1,E2,E3);
> > if ((x==NULL) || ...) S
> > - memset((T2)x,0,E2);
>
> I don't know much about SmPL, but wouldn't having that if statement
> there reduce your matches?
No, not really.
Almost none of the pci_alloc_consistent calls
do not have a test for failure immediately after
them.
Coccinelle is a very cool code transformation tool,
quite useful for these sorts of patch conversions.
http://coccinelle.lip6.fr/documentation.php
--
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