Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Wols Lists <antlists@youngman.org.uk>
To: Gioh Kim <gi-oh.kim@profitbricks.com>,
	jes.sorensen@gmail.com, neilb@suse.com
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2] mdadm.c: fix compile error "switch condition has boolean value"
Date: Thu, 30 Mar 2017 18:50:44 +0100	[thread overview]
Message-ID: <58DD4574.3020803@youngman.org.uk> (raw)
In-Reply-To: <1490893093-4666-1-git-send-email-gi-oh.kim@profitbricks.com>

You can add my acked-by (never done it before, not sure how :-)

Cheers,
Wol

On 30/03/17 17:58, Gioh Kim wrote:
> Remove a boolean expression in switch condition
> to prevent compile error of some compilers,
> for example, gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2).
> 
> Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
> ---
>  mdadm.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/mdadm.c b/mdadm.c
> index 0f32773..d6b5437 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -1965,14 +1965,12 @@ static int misc_list(struct mddev_dev *devlist,
>  			rv |= SetAction(dv->devname, c->action);
>  			continue;
>  		}
> -		switch(dv->devname[0] == '/') {
> -			case 0:
> -				mdfd = open_dev(dv->devname);
> -				if (mdfd >= 0)
> -					break;
> -			case 1:
> -				mdfd = open_mddev(dv->devname, 1);  
> -		}
> +
> +		if (dv->devname[0] != '/')
> +			mdfd = open_dev(dv->devname);
> +		if (dv->devname[0] == '/' || mdfd < 0)
> +			mdfd = open_mddev(dv->devname, 1);
> +
>  		if (mdfd >= 0) {
>  			switch(dv->disposition) {
>  			case 'R':
> 

  reply	other threads:[~2017-03-30 17:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 16:58 [PATCHv2] mdadm.c: fix compile error "switch condition has boolean value" Gioh Kim
2017-03-30 17:50 ` Wols Lists [this message]
2017-03-30 17:51 ` Jes Sorensen

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=58DD4574.3020803@youngman.org.uk \
    --to=antlists@youngman.org.uk \
    --cc=gi-oh.kim@profitbricks.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox