public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	Ondrej Zary <linux@rainbow-software.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins()
Date: Tue, 13 Nov 2012 08:53:01 +0100	[thread overview]
Message-ID: <s5hhaouvt0i.wl%tiwai@suse.de> (raw)
In-Reply-To: <20121113074454.GB13198@elgon.mountain>

At Tue, 13 Nov 2012 10:44:54 +0300,
Dan Carpenter wrote:
> 
> I don't think this works as intended.  '|' higher precedence than ?: so
> the bitwize OR "0 | (val & STR_MOST)" is a no-op.
> 
> I have re-written it to be more clear.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied now.


Takashi

> ---
> I don't have a way to test this.
> 
> diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
> index 50169bc..7266020 100644
> --- a/sound/pci/es1968.c
> +++ b/sound/pci/es1968.c
> @@ -2581,9 +2581,14 @@ static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea)
>  	struct es1968 *chip = tea->private_data;
>  	unsigned long io = chip->io_port + GPIO_DATA;
>  	u16 val = inw(io);
> -
> -	return  (val & STR_DATA) ? TEA575X_DATA : 0 |
> -		(val & STR_MOST) ? TEA575X_MOST : 0;
> +	u8 ret;
> +
> +	ret = 0;
> +	if (val & STR_DATA)
> +		ret |= TEA575X_DATA;
> +	if (val & STR_MOST)
> +		ret |= TEA575X_MOST;
> +	return ret;
>  }
>  
>  static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool output)
> 

  reply	other threads:[~2012-11-13  7:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13  7:44 [patch] ALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins() Dan Carpenter
2012-11-13  7:53 ` Takashi Iwai [this message]
2012-11-13  8:03 ` Joe Perches
2012-11-14  8:27   ` Dan Carpenter
2012-11-14 21:24 ` Ondrej Zary

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=s5hhaouvt0i.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    --cc=hdegoede@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rainbow-software.org \
    --cc=mchehab@redhat.com \
    --cc=perex@perex.cz \
    --cc=rusty@rustcorp.com.au \
    /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