lkml.org 
[lkml]   [2008]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [2.6 patch] mtd/cmdlinepart.c: don't compare pointers with 0
Hello.

Adrian Bunk wrote:

> 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>

> 32de76e83f37322dd85eaecf126e7b17327f606f 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)
> {

Wouldn't it be nice to join the standalone brace to if () while it?

> printk(KERN_ERR ERRP "no closing %c found in partition name\n", delim);
> return NULL;

WBR, Sergei


\
 
 \ /
  Last update: 2008-04-14 16:45    [W:0.032 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site