Skip to content

Commit

Permalink
[MTD] cmdlinepart.c: don't compare pointers with 0
Browse files Browse the repository at this point in the history
Sparse spotted that 0 was compared to pointers.

While I was at it, I also moved the assignments out of the if's.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
Adrian Bunk authored and David Woodhouse committed Apr 22, 2008
1 parent 456d9fc commit ed262c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/mtd/cmdlinepart.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ static struct mtd_partition * newpart(char *s,
char *p;

name = ++s;
if ((p = strchr(name, delim)) == 0)
p = strchr(name, delim);
if (!p)
{
printk(KERN_ERR ERRP "no closing %c found in partition name\n", delim);
return NULL;
Expand Down Expand Up @@ -159,9 +160,10 @@ static struct mtd_partition * newpart(char *s,
return NULL;
}
/* more partitions follow, parse them */
if ((parts = newpart(s + 1, &s, num_parts,
this_part + 1, &extra_mem, extra_mem_size)) == 0)
return NULL;
parts = newpart(s + 1, &s, num_parts, this_part + 1,
&extra_mem, extra_mem_size);
if (!parts)
return NULL;
}
else
{ /* this is the last partition: allocate space for all */
Expand Down

0 comments on commit ed262c4

Please sign in to comment.