Skip to content

Commit

Permalink
UBIFS: use an IS_ERR test rather than a NULL test
Browse files Browse the repository at this point in the history
In case of error, the function kthread_create returns an ERR pointer,
but never returns a NULL pointer. So a NULL test that comes before an
IS_ERR test should be deleted.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@match_bad_null_test@
expression x, E;
statement S1,S2;
@@
x = kthread_create(...)
... when != x = E
* if (x == NULL)
S1 else S2
// </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>
  • Loading branch information
Julien Brunel authored and Artem Bityutskiy committed Sep 30, 2008
1 parent 746103a commit a70948b
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,6 @@ static int mount_ubifs(struct ubifs_info *c)

/* Create background thread */
c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
if (!c->bgt)
c->bgt = ERR_PTR(-EINVAL);
if (IS_ERR(c->bgt)) {
err = PTR_ERR(c->bgt);
c->bgt = NULL;
Expand Down Expand Up @@ -1347,8 +1345,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)

/* Create background thread */
c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
if (!c->bgt)
c->bgt = ERR_PTR(-EINVAL);
if (IS_ERR(c->bgt)) {
err = PTR_ERR(c->bgt);
c->bgt = NULL;
Expand Down

0 comments on commit a70948b

Please sign in to comment.