[MTD] cmdlinepart.c: don't compare pointers with 0
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Apr 22 11:59:02 EDT 2008
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ed262c4f5cb8291668c27c88a022bd7628f067a4
Commit: ed262c4f5cb8291668c27c88a022bd7628f067a4
Parent: 456d9fc92eb8635d53e8facc57764464b8759173
Author: Adrian Bunk <bunk at kernel.org>
AuthorDate: Mon Apr 14 17:20:04 2008 +0300
Committer: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Apr 22 15:55:38 2008 +0100
[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 <bunk at kernel.org>
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
drivers/mtd/cmdlinepart.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index b44292a..3e09043 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 */
More information about the linux-mtd-cvs
mailing list