The complate semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@
// identify a function that returns a negative return value at least once.
f(...) {
... when any
(
return -c@i;
|
ret = -c@i;
... when
hen !=
*if(...)
{
... when != ret = e2
when forall
return ret;
}
//
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---
drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c | 12 +++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/oma
Add NULL test on call to devm_kzalloc.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x;
identifier fld;
@@
* x = devm_kzalloc(...);
... when != x == NULL
x->fld
//
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---
Add NULL tests on various calls to kzalloc and devm_kzalloc.
The semantic match that finds these problems is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x,y;
identifier fld;
@@
(
x = \(vmalloc\|kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|krealloc\|
kmemdup\|kstrdup\|
On Tue, 1 Dec 2015, Boris Brezillon wrote:
> Add nand-priv-no-mtd.cocci to detect and correct NAND controller drivers
> directly embedding an mtd_info struct in their private struct.
>
> Signed-off-by: Boris Brezillon <boris.brezil...@free-electrons.com>
> Cc: Julia Lawall
On Tue, 17 Nov 2015, Boris Brezillon wrote:
> Hi Julia,
>
> On Tue, 17 Nov 2015 10:05:03 +0100 (CET)
> Julia Lawall <julia.law...@lip6.fr> wrote:
>
> > > > (This isn't the worst one, but it just happens to be one of the first.)
> > > > There
> > (This isn't the worst one, but it just happens to be one of the first.)
> > There are many cases where the typical style would be to declare a new
> > variable at the top of the function, where you perform the
> > macro/function-call to convert from one abstraction to another. Like
> >
> >
The clk_hw_omap_ops structures are never modified, so declare this one as
const, like the others.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---
drivers/clk/ti/apll.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/
Device node iterators perform an of_node_put on each iteration, so putting
an of_node_put before going around to the next iteration results in a
double put.
The complete semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):
//
@r exists@
expression e1,e2;
local
;
iterator i;
@@
i(..., child, ...) {
... when != of_node_get(child)
* of_node_put(child);
...
* continue;
}
//
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---
drivers/video/fbdev/omap2/dss/omapdss-boot-init.c |4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff
!= ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// /smpl
Signed-off-by: Julia Lawall julia.law...@lip6.fr
---
drivers/mmc/host/omap.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 70dcf07
The complate semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@
// identify a function that returns a negative return value at least once.
f(...) {
... when any
(
return -c@i;
|
ret = -c@i;
...
From: Julia Lawall julia.law...@lip6.fr
It was forgotten to initialize ret to the result of calling
snd_soc_dai_set_sysclk, unlike at the other calls in the same function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
Please ignore. Wrong patch set.
On Sun, 5 Apr 2015, Julia Lawall wrote:
From: Julia Lawall julia.law...@lip6.fr
It was forgotten to initialize ret to the result of calling
snd_soc_dai_set_sysclk, unlike at the other calls in the same function.
A simplified version of the semantic match
On Fri, 6 Feb 2015, Quentin Lambert wrote:
On 06/02/2015 03:15, Stephen Boyd wrote:
Thanks for the coccinelle patch. Thinking more about it, I don't think
we care if the pointer is dereferenced because that would require a
definition of struct clk and that is most likely not the case
On Mon, 2 Feb 2015, Stephen Boyd wrote:
On 02/01/15 13:24, Mike Turquette wrote:
Quoting Tomeu Vizoso (2015-01-23 03:03:30)
Moves clock state to struct clk_core, but takes care to change as little
API as
possible.
struct clk_hw still has a pointer to a struct clk, which is the
From: Julia Lawall julia.law...@lip6.fr
It was forgotten to initialize ret to the result of calling
snd_soc_dai_set_sysclk, unlike at the other calls in the same function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
From: Julia Lawall julia.law...@lip6.fr
Copy-paste error from the previous block of error handling code.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@@
expression e,e1;
@@
if (IS_ERR(e)) {
...
(
ret = PTR_ERR(e
The complate semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@
// identify a function that returns a negative return value at least once.
f(...) {
... when any
(
return -c@i;
|
ret = -c@i;
...
From: Julia Lawall julia.law...@lip6.fr
Return a negative error code on failure.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret 0\|ret != 0\))
{ ... return ret; }
|
ret
From: Julia Lawall julia.law...@lip6.fr
Use c99 initializers for structures.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@decl@
identifier i1,fld;
type T;
field list[n] fs;
@@
struct i1 {
fs
T fld;
...};
@bad
These patches add labels in the initializations of structure fields (c99
initializers). The complete semantic patch thta makes this change is shown
below. This rule ignores cases where the initialization is just 0 or NULL,
where some of the fields already use labels, and where there are nested
devm_ioremap_resource often uses the result of a call to
platform_get_resource_byname as its last argument. devm_ioremap_resource
does appropriate error handling on this argument, so error handling can be
removed from the call to platform_get_resource_byname.
The semantic patch that makes this
From: Julia Lawall julia.law...@lip6.fr
Remove unneeded error handling on the result of a call to
platform_get_resource_byname when the value is passed to devm_ioremap_resource.
In the case of omap-dmic.c, the error-handling code of
devm_ioremap_resource is also corrected to include releasing
From: Julia Lawall julia.law...@lip6.fr
Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// smpl
devm_ioremap_resource often uses the result of a call to
platform_get_resource as its last argument. devm_ioremap_resource does
appropriate error handling on this argument, so error handling can be
removed from the call site. To make the connection between the call to
platform_get_resource and
From: Julia Lawall julia.law...@lip6.fr
Replace a comma between expression statements by a semicolon. This changes
the semantics of the code, but given the current indentation appears to be
what is intended.
A simplified version of the semantic patch that performs this
transformation
From: Julia Lawall julia.law...@lip6.fr
Replace a comma between expression statements by a semicolon.
A simplified version of the semantic patch that performs this
transformation is as follows: (http://coccinelle.lip6.fr/)
// smpl
@r@
expression e1,e2,e;
type T;
identifier i;
@@
e1
-,
+;
e2
From: Julia Lawall julia.law...@lip6.fr
Delete successive tests to the same location. Data is the just previously
allocated and tested value. Test the result of the allocation made here
instead.
A simplified version of the semantic match that finds this problem is as
follows: (http
From: Julia Lawall julia.law...@lip6.fr
Just use WARN_ON rather than an if containing only WARN_ON(1).
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
- if (e) WARN_ON(1);
+ WARN_ON(e);
// /smpl
From: Julia Lawall julia.law...@lip6.fr
It was forgotten to initialize ret to the result of calling
snd_soc_dai_set_sysclk, unlike at the other calls in the same function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
From: Julia Lawall julia.law...@lip6.fr
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.
Signed-off-by: Julia
The semantic patch (http://coccinelle.lip6.fr/) used in generating this
patch is as follows. Some manual cleanup was required.
virtual after_start
virtual returned
virtual arg
virtual get
virtual drop_labels
// -
// find
From: Julia Lawall julia.law...@lip6.fr
Add missing iounmap in error handling code, in a case where the function
already preforms iounmap on some other execution path.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
!= if (...) { +...x...+ }
x-f1
...
(
return \(0\|+...x...+\|ptr\);
|
return@p2 ...;
)
@script:python@
p1 r.p1;
p2 r.p2;
@@
print * file: %s kmalloc %s return %s % (p1[0].file,p1[0].line,p2[0].line)
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
drivers/usb/dwc3/dwc3-pci.c |2 +-
1 file changed
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/arm/mach-omap2/devices.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 46dfd1a..3334a47 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
From: Julia Lawall ju...@diku.dk
Test the just-initialized value rather than some other one.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@r@
identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST};
statement S;
@@
x = f(...);
(
if (\(x == NULL\|IS_ERR(x
From: Julia Lawall ju...@diku.dk
At this point, the ioremap has taken place, so the error handling code at
the label err_iounmap should be used rather than returning directly.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@r@
identifier x
From: Julia Lawall ju...@diku.dk
Add missing call to clk_put.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@r exists@
expression e1,e2;
statement S;
@@
e1 = clk_get@p1(...);
... when != e1 = e2
when != clk_put(e1
From: Julia Lawall ju...@diku.dk
Platform_device_del should be called before platform_device_put, as
platform_device_put can delete the structure.
Additionally, improve the error handling code for the call to ioremap, so
that it calls platform_device_put.
The semantic match that finds
);
}
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/arm/mach-omap2/dma.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -264,7 +264,7
;
@@
x = f(...)
... when != IS_ERR(x)
(
if (IS_ERR(x) ||...) S1 else S2
|
*x-fld
)
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/arm/mach-omap2/smartreflex.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-omap2/smartreflex.c
b/arch/arm/mach
From: Julia Lawall ju...@diku.dk
Delete successive assignments to the same location. Initialize the out_y
field as well as the out_x field, rather than initializing the out_x field
twice.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6
From: Julia Lawall ju...@diku.dk
Add a mutex_unlock missing on the error paths. The use of the mutex is
balanced elsewhere in the file.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression E1;
@@
* mutex_lock(E1,...);
+... when != E1
From: Julia Lawall ju...@diku.dk
map_iovm_area is only called from a context where its second argument is
known not to be NULL, so drop the unnecessary test. If new could be NULL,
the initialization of da should be moved below the test.
A simplified version of the semantic match that detects
From: Julia Lawall ju...@diku.dk
The function map_iovm_area is static and is only called from one place, at
which the new argument cannot be NULL.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
type T;
expression E,E1;
identifier i,fld
From: Julia Lawall ju...@diku.dk
If the NULL test is necessary, then the dereference should be moved below
the NULL test.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
type T;
expression E,E1;
identifier i,fld;
statement S;
@@
- T i
47 matches
Mail list logo