alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [patch] oxygen: clean up.  make precedence explicit
@ 2010-02-19  6:58 Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2010-02-19  6:58 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, kernel-janitors, Clemens Ladisch

This doesn't change anything, but I think it makes the code clearer.  
It silences a smatch warning:
sound/pci/oxygen/oxygen_mixer.c +91 dac_mute_put(7) warn: add some parenthesis here?

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Compile tested.

diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index f375b8a..28590b9 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl,
 	int changed;
 
 	mutex_lock(&chip->mutex);
-	changed = !value->value.integer.value[0] != chip->dac_mute;
+	changed = (!value->value.integer.value[0]) != chip->dac_mute;
 	if (changed) {
 		chip->dac_mute = !value->value.integer.value[0];
 		chip->model.update_dac_mute(chip);

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re: [patch] oxygen: clean up. make precedence explicit
@ 2010-02-19  8:29 Clemens Ladisch
  2010-02-19 10:10 ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2010-02-19  8:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

> This doesn't change anything, but I think it makes the code clearer.
> It silences a smatch warning:
> sound/pci/oxygen/oxygen_mixer.c +91 dac_mute_put(7) warn: add some parenthesis here?

That message doesn't say why some parentheses should be added.
And it's a question; how do I give it the answer "no"?  :-)

> -	changed = !value->value.integer.value[0] != chip->dac_mute;
> +	changed = (!value->value.integer.value[0]) != chip->dac_mute;

This doesn't look any clearer to me; I don't think that the unary
negation operator could be thought to have lower precedence than "!=".

Why does smatch warn about this combination?  Do such errors actually
happen?


Regards,
Clemens

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-19 20:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-19  6:58 [patch] oxygen: clean up. make precedence explicit Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2010-02-19  8:29 Clemens Ladisch
2010-02-19 10:10 ` Dan Carpenter
     [not found]   ` <1266575610.31443.6.camel@thorin>
2010-02-19 11:29     ` Dan Carpenter
2010-02-19 16:58       ` Dan Carpenter
     [not found]       ` <1266584951.31443.15.camel@thorin>
2010-02-19 17:24         ` Clemens Ladisch
2010-02-19 20:08           ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).