mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: "André Goddard Rosa" <andre.goddard@gmail.com>
Cc: gregkh@suse.de, alan@linux.intel.com,
	Andrew Morton <akpm@linux-foundation.org>,
	adobriyan@gmail.com, linux list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] serial: cascade needless conditionals
Date: Sun, 25 Oct 2009 14:20:19 -0200	[thread overview]
Message-ID: <20091025162019.GA10898@khazad-dum.debian.net> (raw)
In-Reply-To: <b8bf37780910250618h3edce547y41a8dd03e4fb4e71@mail.gmail.com>

On Sun, 25 Oct 2009, André Goddard Rosa wrote:
>  	if (flags == UPF_SPD_HI)
>  		altbaud = 57600;
> -	if (flags == UPF_SPD_VHI)
> +	else if (flags == UPF_SPD_VHI)
>  		altbaud = 115200;
> -	if (flags == UPF_SPD_SHI)
> +	else if (flags == UPF_SPD_SHI)
>  		altbaud = 230400;
> -	if (flags == UPF_SPD_WARP)
> +	else if (flags == UPF_SPD_WARP)
>  		altbaud = 460800;

This changes code behaviour if more than one bit is set (which might never
happen for all I know...).  You should invert the order of the tests if you
want to make sure it is side-effect-free. 

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

  reply	other threads:[~2009-10-25 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25 13:18 André Goddard Rosa
2009-10-25 16:20 ` Henrique de Moraes Holschuh [this message]
2009-10-25 16:37   ` André Goddard Rosa
2009-10-25 18:39     ` Henrique de Moraes Holschuh

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=20091025162019.GA10898@khazad-dum.debian.net \
    --to=hmh@hmh.eng.br \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=andre.goddard@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®