diff mbox

ALSA: oxfw: fix a condition in start_stream()

Message ID 20150226203202.GC6820@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Feb. 26, 2015, 8:32 p.m. UTC
Static checkers complain that this function doesn't return negative
error codes.  The comments for amdtp_stream_wait_callback() say that we
should stop the stream if it returns false.

Fixes: f3699e2c7745 ('ALSA: oxfw: Change the way to start stream')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Takashi Sakamoto Feb. 27, 2015, 12:36 a.m. UTC | #1
Hi Dan,

On Feb 27 2015 05:32, Dan Carpenter wrote:
> Static checkers complain that this function doesn't return negative
> error codes.  The comments for amdtp_stream_wait_callback() say that we
> should stop the stream if it returns false.
> 
> Fixes: f3699e2c7745 ('ALSA: oxfw: Change the way to start stream')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for this patch, while the error code should be assigned to
-ETIMEDOUT, as the other drivers do.

I post an alternative patch to fix them.


Thanks

Takashi Sakamoto

> diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
> index 29ccb36..ee67581 100644
> --- a/sound/firewire/oxfw/oxfw-stream.c
> +++ b/sound/firewire/oxfw/oxfw-stream.c
> @@ -172,7 +172,7 @@ static int start_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream,
>  
>  	/* Wait first packet */
>  	err = amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT);
> -	if (err < 0)
> +	if (err == 0)
>  		stop_stream(oxfw, stream);
>  end:
>  	return err;
diff mbox

Patch

diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
index 29ccb36..ee67581 100644
--- a/sound/firewire/oxfw/oxfw-stream.c
+++ b/sound/firewire/oxfw/oxfw-stream.c
@@ -172,7 +172,7 @@  static int start_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream,
 
 	/* Wait first packet */
 	err = amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT);
-	if (err < 0)
+	if (err == 0)
 		stop_stream(oxfw, stream);
 end:
 	return err;