From: Adrian Bunk Date: Mon, 14 Apr 2008 14:20:04 +0000 (+0300) Subject: [MTD] cmdlinepart.c: don't compare pointers with 0 X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~37771^2~48 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ed262c4f5cb8291668c27c88a022bd7628f067a4;p=mirror_ubuntu-focal-kernel.git [MTD] cmdlinepart.c: don't compare pointers with 0 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 Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c index b44292abd9f7..3e090436396d 100644 --- a/drivers/mtd/cmdlinepart.c +++ b/drivers/mtd/cmdlinepart.c @@ -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; @@ -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 */