* linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ?
[not found] <DUB128-W44E71E14CBE4AC54396DFA9C6B0@phx.gbl>
@ 2016-04-18 16:17 ` David Binderman
2016-04-19 13:31 ` Takashi Iwai
2016-04-21 6:38 ` [alsa-devel] " Clemens Ladisch
0 siblings, 2 replies; 6+ messages in thread
From: David Binderman @ 2016-04-18 16:17 UTC (permalink / raw)
To: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Hello there,
[linux-4.6-rc4/sound/pci/ens1370.c:1551]: (style) Expression '(X & 0xf0000)>= 0x4' is always false.
Source code is
if ((ensoniq->ctrl & ES_1371_GPIO_OUTM)>= 4)
val = 1;
Regards
David Binderman
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ?
2016-04-18 16:17 ` linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ? David Binderman
@ 2016-04-19 13:31 ` Takashi Iwai
2016-04-21 6:38 ` [alsa-devel] " Clemens Ladisch
1 sibling, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2016-04-19 13:31 UTC (permalink / raw)
To: David Binderman; +Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
On Mon, 18 Apr 2016 18:17:58 +0200,
David Binderman wrote:
>
> Hello there,
>
> [linux-4.6-rc4/sound/pci/ens1370.c:1551]: (style) Expression '(X & 0xf0000)>= 0x4' is always false.
>
> Source code is
>
> if ((ensoniq->ctrl & ES_1371_GPIO_OUTM)>= 4)
> val = 1;
Thanks for the report. It's fixed now by the patch below.
Takashi
-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: ens1371: Fix "Line In->Rear Out Switch" control
The "Line In->Rear Out Switch" control on ens1371 driver returns a
bogus value, always true, as its check is totally broken. Fix it to
check the proper GPIO bit mask.
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/ens1370.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 0dc44ebb0032..626cd2167d29 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1548,7 +1548,7 @@ static int snd_es1373_line_get(struct snd_kcontrol *kcontrol,
int val = 0;
spin_lock_irq(&ensoniq->reg_lock);
- if ((ensoniq->ctrl & ES_1371_GPIO_OUTM) >= 4)
+ if (ensoniq->ctrl & ES_1371_GPIO_OUT(4))
val = 1;
ucontrol->value.integer.value[0] = val;
spin_unlock_irq(&ensoniq->reg_lock);
--
2.8.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ?
@ 2016-04-19 13:31 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2016-04-19 13:31 UTC (permalink / raw)
To: David Binderman
Cc: alsa-devel@alsa-project.org, perex@perex.cz,
linux-kernel@vger.kernel.org
On Mon, 18 Apr 2016 18:17:58 +0200,
David Binderman wrote:
>
> Hello there,
>
> [linux-4.6-rc4/sound/pci/ens1370.c:1551]: (style) Expression '(X & 0xf0000)>= 0x4' is always false.
>
> Source code is
>
> if ((ensoniq->ctrl & ES_1371_GPIO_OUTM)>= 4)
> val = 1;
Thanks for the report. It's fixed now by the patch below.
Takashi
-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: ens1371: Fix "Line In->Rear Out Switch" control
The "Line In->Rear Out Switch" control on ens1371 driver returns a
bogus value, always true, as its check is totally broken. Fix it to
check the proper GPIO bit mask.
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/ens1370.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 0dc44ebb0032..626cd2167d29 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1548,7 +1548,7 @@ static int snd_es1373_line_get(struct snd_kcontrol *kcontrol,
int val = 0;
spin_lock_irq(&ensoniq->reg_lock);
- if ((ensoniq->ctrl & ES_1371_GPIO_OUTM) >= 4)
+ if (ensoniq->ctrl & ES_1371_GPIO_OUT(4))
val = 1;
ucontrol->value.integer.value[0] = val;
spin_unlock_irq(&ensoniq->reg_lock);
--
2.8.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ?
2016-04-18 16:17 ` linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ? David Binderman
@ 2016-04-21 6:38 ` Clemens Ladisch
2016-04-21 6:38 ` [alsa-devel] " Clemens Ladisch
1 sibling, 0 replies; 6+ messages in thread
From: Clemens Ladisch @ 2016-04-21 6:38 UTC (permalink / raw)
To: David Binderman, perex@perex.cz, tiwai@suse.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
David Binderman wrote:
> [linux-4.6-rc4/sound/pci/ens1370.c:1551]: (style) Expression '(X & 0xf0000)>= 0x4' is always false.
What tool generated this message?
> Source code is
>
> if ((ensoniq->ctrl & ES_1371_GPIO_OUTM)>= 4)
> val = 1;
This message is wrong; it is certainly possible for this to be true.
However, there is a different bug: 4 must be ES_1371_GPIO_OUT(4).
Regards,
Clemens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [alsa-devel] linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ?
@ 2016-04-21 6:38 ` Clemens Ladisch
0 siblings, 0 replies; 6+ messages in thread
From: Clemens Ladisch @ 2016-04-21 6:38 UTC (permalink / raw)
To: David Binderman, perex@perex.cz, tiwai@suse.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
David Binderman wrote:
> [linux-4.6-rc4/sound/pci/ens1370.c:1551]: (style) Expression '(X & 0xf0000)>= 0x4' is always false.
What tool generated this message?
> Source code is
>
> if ((ensoniq->ctrl & ES_1371_GPIO_OUTM)>= 4)
> val = 1;
This message is wrong; it is certainly possible for this to be true.
However, there is a different bug: 4 must be ES_1371_GPIO_OUT(4).
Regards,
Clemens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ?
2016-04-21 6:38 ` [alsa-devel] " Clemens Ladisch
(?)
@ 2016-04-21 7:11 ` David Binderman
-1 siblings, 0 replies; 6+ messages in thread
From: David Binderman @ 2016-04-21 7:11 UTC (permalink / raw)
To: Clemens Ladisch, perex@perex.cz, tiwai@suse.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Hello there,
----------------------------------------
> David Binderman wrote:
>> [linux-4.6-rc4/sound/pci/ens1370.c:1551]: (style) Expression '(X & 0xf0000)>= 0x4' is always false.
>
> What tool generated this message?
A static analysis tool called cppcheck, available from sourceforge.
Regards
David Binderman
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-21 7:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <DUB128-W44E71E14CBE4AC54396DFA9C6B0@phx.gbl>
2016-04-18 16:17 ` linux-4.6-rc4/sound/pci/ens1370.c:1551: possible bad expression ? David Binderman
2016-04-19 13:31 ` Takashi Iwai
2016-04-19 13:31 ` Takashi Iwai
2016-04-21 6:38 ` Clemens Ladisch
2016-04-21 6:38 ` [alsa-devel] " Clemens Ladisch
2016-04-21 7:11 ` David Binderman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.