Re: [alsa-devel] [PATCH] Fix logical-not-parentheses warning
On Sun, 2015-08-02 at 02:08 -0700, Tomer Barletz wrote:
This fixes the following warning, that is seen with gcc 5.1: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]. [] diff --git a/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;
It seems this is because dac_mute's value is inverted 0 means true, 1 is false. I think it'd be simpler if dac_mute was converted to a standard bool (or perhaps renamed to not_muted) and this test was rewritten. Using !!value->value.integer.value[0] would also be more readable and intelligible.
participants (1)
-
Joe Perches