diff mbox

ALSA: bebob: sizeof() vs ARRAY_SIZE() typo

Message ID 20140528164330.GD1824@mwanda (mailing list archive)
State Accepted
Commit 33a5f989de41622ae691b12f008390309b59ad74
Headers show

Commit Message

Dan Carpenter May 28, 2014, 4:43 p.m. UTC
ARRAY_SIZE() was intended here instead of sizeof().  The
"bridgeco_freq_table" array holds integers so the original condition is
never true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Takashi Sakamoto May 28, 2014, 9:58 p.m. UTC | #1
(May 19 2014 01:43), Dan Carpenter wrote:
> ARRAY_SIZE() was intended here instead of sizeof().  The
> "bridgeco_freq_table" array holds integers so the original condition is
> never true.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

> diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
> index 514c7c9..bc4f827 100644
> --- a/sound/firewire/bebob/bebob_stream.c
> +++ b/sound/firewire/bebob/bebob_stream.c
> @@ -749,7 +749,7 @@ parse_stream_formation(u8 *buf, unsigned int len,
>  		if (buf[2] == bridgeco_freq_table[i])
>  			break;
>  	}
> -	if (i == sizeof(bridgeco_freq_table))
> +	if (i == ARRAY_SIZE(bridgeco_freq_table))
>  		return -ENOSYS;
>  
>  	/* Avoid double count by different entries for the same rate. */
Takashi Iwai May 29, 2014, 1:58 p.m. UTC | #2
At Wed, 28 May 2014 19:43:30 +0300,
Dan Carpenter wrote:
> 
> ARRAY_SIZE() was intended here instead of sizeof().  The
> "bridgeco_freq_table" array holds integers so the original condition is
> never true.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
> index 514c7c9..bc4f827 100644
> --- a/sound/firewire/bebob/bebob_stream.c
> +++ b/sound/firewire/bebob/bebob_stream.c
> @@ -749,7 +749,7 @@ parse_stream_formation(u8 *buf, unsigned int len,
>  		if (buf[2] == bridgeco_freq_table[i])
>  			break;
>  	}
> -	if (i == sizeof(bridgeco_freq_table))
> +	if (i == ARRAY_SIZE(bridgeco_freq_table))
>  		return -ENOSYS;
>  
>  	/* Avoid double count by different entries for the same rate. */
>
diff mbox

Patch

diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
index 514c7c9..bc4f827 100644
--- a/sound/firewire/bebob/bebob_stream.c
+++ b/sound/firewire/bebob/bebob_stream.c
@@ -749,7 +749,7 @@  parse_stream_formation(u8 *buf, unsigned int len,
 		if (buf[2] == bridgeco_freq_table[i])
 			break;
 	}
-	if (i == sizeof(bridgeco_freq_table))
+	if (i == ARRAY_SIZE(bridgeco_freq_table))
 		return -ENOSYS;
 
 	/* Avoid double count by different entries for the same rate. */