All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Adrian Bunk <bunk@kernel.org>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [2.6 patch] mtd/cmdlinepart.c: don't compare pointers with 0
Date: Mon, 14 Apr 2008 18:42:11 +0400	[thread overview]
Message-ID: <48036D43.6070307@ru.mvista.com> (raw)
In-Reply-To: <20080414142004.GR6695@cs181133002.pp.htv.fi>

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

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Adrian Bunk <bunk@kernel.org>
Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [2.6 patch] mtd/cmdlinepart.c: don't compare pointers with 0
Date: Mon, 14 Apr 2008 18:42:11 +0400	[thread overview]
Message-ID: <48036D43.6070307@ru.mvista.com> (raw)
In-Reply-To: <20080414142004.GR6695@cs181133002.pp.htv.fi>

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

  reply	other threads:[~2008-04-14 14:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-14 14:20 [2.6 patch] mtd/cmdlinepart.c: don't compare pointers with 0 Adrian Bunk
2008-04-14 14:42 ` Sergei Shtylyov [this message]
2008-04-14 14:42   ` Sergei Shtylyov
2008-04-14 16:10   ` Adrian Bunk
2008-04-14 16:10     ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48036D43.6070307@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=bunk@kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.