diff mbox series

[next] ALSA: bebob: Fix bit flag quirk constants

Message ID 20210615142048.59900-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit 36d1a6729be5b0d784f632aa1fd1fd11511e11c0
Headers show
Series [next] ALSA: bebob: Fix bit flag quirk constants | expand

Commit Message

Colin King June 15, 2021, 2:20 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The quirking bit-flags are currently set as contiguous integer enum values
and so currently SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC is zero and so
he quirking never getting set or tested correctly for this quirk. Fix this
by setting the quirking constants as shifted bit values.

Addresses-Coverity: ("Bitwise-and with zero")
Fixes: 93cd12d6e88a ("ALSA: bebob: code refactoring for model-dependent quirks")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/firewire/bebob/bebob.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Takashi Sakamoto June 15, 2021, 10:39 p.m. UTC | #1
Hi,

On Tue, Jun 15, 2021 at 03:20:48PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The quirking bit-flags are currently set as contiguous integer enum values
> and so currently SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC is zero and so
> he quirking never getting set or tested correctly for this quirk. Fix this
> by setting the quirking constants as shifted bit values.
> 
> Addresses-Coverity: ("Bitwise-and with zero")
> Fixes: 93cd12d6e88a ("ALSA: bebob: code refactoring for model-dependent quirks")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  sound/firewire/bebob/bebob.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h
> index c06579d9380e..4d73ecb30d79 100644
> --- a/sound/firewire/bebob/bebob.h
> +++ b/sound/firewire/bebob/bebob.h
> @@ -76,8 +76,8 @@ struct snd_bebob_spec {
>  };
>  
>  enum snd_bebob_quirk {
> -	SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC,
> -	SND_BEBOB_QUIRK_WRONG_DBC,
> +	SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC = (1 << 0),
> +	SND_BEBOB_QUIRK_WRONG_DBC		  = (1 << 1),
>  };
>  
>  struct snd_bebob {
> -- 
> 2.31.1

Nice to catch it. Indeed, I overlook it...

Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>


Thanks

Takashi Sakamoto
Takashi Iwai June 16, 2021, 6:53 a.m. UTC | #2
On Tue, 15 Jun 2021 16:20:48 +0200,
Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> The quirking bit-flags are currently set as contiguous integer enum values
> and so currently SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC is zero and so
> he quirking never getting set or tested correctly for this quirk. Fix this
> by setting the quirking constants as shifted bit values.
> 
> Addresses-Coverity: ("Bitwise-and with zero")
> Fixes: 93cd12d6e88a ("ALSA: bebob: code refactoring for model-dependent quirks")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h
index c06579d9380e..4d73ecb30d79 100644
--- a/sound/firewire/bebob/bebob.h
+++ b/sound/firewire/bebob/bebob.h
@@ -76,8 +76,8 @@  struct snd_bebob_spec {
 };
 
 enum snd_bebob_quirk {
-	SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC,
-	SND_BEBOB_QUIRK_WRONG_DBC,
+	SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC = (1 << 0),
+	SND_BEBOB_QUIRK_WRONG_DBC		  = (1 << 1),
 };
 
 struct snd_bebob {