diff mbox

bebob: Use ARRAY_SIZE() instead of sizeof() for return condition

Message ID 1401518032-7223-1-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto May 31, 2014, 6:33 a.m. UTC
The parser for stream format information should return when detecting wrong
value for sampling rate. But it doesn't.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/bebob/bebob_stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Iwai May 31, 2014, 7:34 a.m. UTC | #1
At Sat, 31 May 2014 15:33:52 +0900,
Takashi Sakamoto wrote:
> 
> The parser for stream format information should return when detecting wrong
> value for sampling rate. But it doesn't.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

This was already fixed by Dan's patch.


thanks,

Takashi


> ---
>  sound/firewire/bebob/bebob_stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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. */
> -- 
> 1.8.3.2
>
Takashi Sakamoto June 1, 2014, 3:04 p.m. UTC | #2
(May 31 2014 16:34), Takashi Iwai wrote:
> At Sat, 31 May 2014 15:33:52 +0900,
> Takashi Sakamoto wrote:
>>
>> The parser for stream format information should return when detecting wrong
>> value for sampling rate. But it doesn't.
>>
>> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> 
> This was already fixed by Dan's patch.

Oops. Exactly. I've posted the same content as Dan posted...
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-May/077254.html

But 'master' branch includes Dan's patch, on the other hand 'for-next'
branch doesn't. I think we're confused with much patches for firewire
stack...
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git


Thanks

Takashi Sakamoto
o-takashi@sakamocchi.jp
Takashi Iwai June 1, 2014, 4:17 p.m. UTC | #3
At Mon, 02 Jun 2014 00:04:49 +0900,
Takashi Sakamoto wrote:
> 
> (May 31 2014 16:34), Takashi Iwai wrote:
> > At Sat, 31 May 2014 15:33:52 +0900,
> > Takashi Sakamoto wrote:
> >>
> >> The parser for stream format information should return when detecting wrong
> >> value for sampling rate. But it doesn't.
> >>
> >> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> > 
> > This was already fixed by Dan's patch.
> 
> Oops. Exactly. I've posted the same content as Dan posted...
> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-May/077254.html
> 
> But 'master' branch includes Dan's patch, on the other hand 'for-next'
> branch doesn't. I think we're confused with much patches for firewire
> stack...
> http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git

My bad, it was applied to a wrong branch.
I cherry-picked the commit to for-next branch now.


thanks,

Takashi
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. */