All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits
@ 2021-02-27  0:15 Colin King
  2021-02-28  8:12   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2021-02-27  0:15 UTC (permalink / raw
  To: Jaroslav Kysela, Takashi Iwai, Pierre-Louis Bossart, Wai Yew CHAY,
	alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently the mask operation on variable conf is just 3 bits so
the switch statement case value of 8 is unreachable dead code.
The function daio_mgr_dao_init can be passed a 4 bit value,
function dao_rsc_init calls it with conf set to:

     conf = (desc->msr & 0x7) | (desc->passthru << 3);

so clearly when desc->passthru is set to 1 then conf can be
at least 8.

Fix this by changing the mask to 0xf.

Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/pci/ctxfi/cthw20k2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index a855fb8c58bd..55af8ef29838 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -991,7 +991,7 @@ static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf)
 
 	if (idx < 4) {
 		/* S/PDIF output */
-		switch ((conf & 0x7)) {
+		switch ((conf & 0xf)) {
 		case 1:
 			set_field(&ctl->txctl[idx], ATXCTL_NUC, 0);
 			break;
-- 
2.30.0


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

* Re: [PATCH] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits
  2021-02-27  0:15 [PATCH] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits Colin King
@ 2021-02-28  8:12   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-02-28  8:12 UTC (permalink / raw
  To: Colin King
  Cc: alsa-devel, linux-kernel, kernel-janitors, Pierre-Louis Bossart,
	Takashi Iwai, Wai Yew CHAY

On Sat, 27 Feb 2021 01:15:27 +0100,
Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently the mask operation on variable conf is just 3 bits so
> the switch statement case value of 8 is unreachable dead code.
> The function daio_mgr_dao_init can be passed a 4 bit value,
> function dao_rsc_init calls it with conf set to:
> 
>      conf = (desc->msr & 0x7) | (desc->passthru << 3);
> 
> so clearly when desc->passthru is set to 1 then conf can be
> at least 8.
> 
> Fix this by changing the mask to 0xf.
> 
> Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks.


Takashi

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

* Re: [PATCH] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits
@ 2021-02-28  8:12   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-02-28  8:12 UTC (permalink / raw
  To: Colin King
  Cc: Jaroslav Kysela, Takashi Iwai, Pierre-Louis Bossart, Wai Yew CHAY,
	alsa-devel, kernel-janitors, linux-kernel

On Sat, 27 Feb 2021 01:15:27 +0100,
Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently the mask operation on variable conf is just 3 bits so
> the switch statement case value of 8 is unreachable dead code.
> The function daio_mgr_dao_init can be passed a 4 bit value,
> function dao_rsc_init calls it with conf set to:
> 
>      conf = (desc->msr & 0x7) | (desc->passthru << 3);
> 
> so clearly when desc->passthru is set to 1 then conf can be
> at least 8.
> 
> Fix this by changing the mask to 0xf.
> 
> Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks.


Takashi

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

end of thread, other threads:[~2021-02-28  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-27  0:15 [PATCH] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits Colin King
2021-02-28  8:12 ` Takashi Iwai
2021-02-28  8:12   ` Takashi Iwai

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.