linux/drivers/mtd/ubi
Julien Brunel 0e4a008a4f UBI: fix IS_ERR test
In case of error, the function add_volume returns an ERR pointer. The
result of IS_ERR, which is supposed to be used in a test as it is, is
here checked to be less than zero, which seems odd. We suggest to
replace this test by a simple IS_ERR test.

A simplified version of the semantic match that finds this problem is
as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@def0@
expression x;
position p0;
@@
x@p0 = add_volume(...)

@protected@
expression def0.x,E;
position def0.p0;
position p;
statement S;
@@
x@p0
... when != x = E
if (!IS_ERR(x) && ...) {<... x@p ...>} else S

@unprotected@
expression def0.x,E;
identifier fld;
position def0.p0;
position p != protected.p;
@@
x@p0
... when != x = E
* x@p->fld
// </smpl>

Signed-off-by:  Julien Brunel <brunel@diku.dk>
Signed-off-by:  Julia Lawall <julia@diku.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-09-26 19:24:37 +03:00
..
build.c UBI: always start the background thread 2008-07-25 11:35:15 +03:00
cdev.c UBI: remove BKL 2008-09-05 16:29:36 +03:00
debug.c UBI: remove pre-sqnum images support 2008-07-24 13:36:09 +03:00
debug.h UBI: fix and re-work debugging stuff 2008-07-24 13:34:45 +03:00
eba.c UBI: fix checkpatch.pl errors and warnings 2008-07-24 13:36:09 +03:00
gluebi.c UBI: fix checkpatch.pl errors and warnings 2008-07-24 13:36:09 +03:00
io.c UBI: fix kernel-doc errors and warnings 2008-07-24 13:36:09 +03:00
kapi.c UBI: fix and re-work debugging stuff 2008-07-24 13:34:45 +03:00
Kconfig UBI: improve Kconfig documentation 2008-04-17 11:32:00 +03:00
Kconfig.debug UBI: Unsorted Block Images 2007-04-27 14:23:33 +03:00
Makefile UBI: Unsorted Block Images 2007-04-27 14:23:33 +03:00
misc.c UBI: avoid unnecessary division operations 2008-07-24 13:32:54 +03:00
scan.c UBI: fix IS_ERR test 2008-09-26 19:24:37 +03:00
scan.h UBI: remove pre-sqnum images support 2008-07-24 13:36:09 +03:00
ubi-media.h UBI: remove pre-sqnum images support 2008-07-24 13:36:09 +03:00
ubi.h UBI: fix kernel-doc errors and warnings 2008-07-24 13:36:09 +03:00
upd.c UBI: fix kernel-doc errors and warnings 2008-07-24 13:36:09 +03:00
vmt.c UBI: fix gcc warning 2008-07-24 13:36:10 +03:00
vtbl.c UBI: remove pre-sqnum images support 2008-07-24 13:36:09 +03:00
wl.c UBI: fix kernel-doc errors and warnings 2008-07-24 13:36:09 +03:00