diff mbox

ALSA: oxfw: fix a condition and return code in start_stream()

Message ID 1424997572-2493-1-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State Accepted
Commit f2b14c0bc510c6a8f67a4f36049deefe5d99a537
Headers show

Commit Message

Takashi Sakamoto Feb. 27, 2015, 12:39 a.m. UTC
The amdtp_stream_wait_callback() doesn't return minus value and
the return code is not for error code.

This commit fixes with a propper condition and an error code.

Fixes: f3699e2c7745 ('ALSA: oxfw: Change the way to start stream')
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/oxfw/oxfw-stream.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Takashi Iwai Feb. 27, 2015, 1:43 p.m. UTC | #1
At Fri, 27 Feb 2015 09:39:32 +0900,
Takashi Sakamoto wrote:
> 
> The amdtp_stream_wait_callback() doesn't return minus value and
> the return code is not for error code.
> 
> This commit fixes with a propper condition and an error code.
> 
> Fixes: f3699e2c7745 ('ALSA: oxfw: Change the way to start stream')
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied, thanks.


Takashi

> ---
>  sound/firewire/oxfw/oxfw-stream.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
> index 29ccb36..e6757cd 100644
> --- a/sound/firewire/oxfw/oxfw-stream.c
> +++ b/sound/firewire/oxfw/oxfw-stream.c
> @@ -171,9 +171,10 @@ 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 (!amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT)) {
>  		stop_stream(oxfw, stream);
> +		err = -ETIMEDOUT;
> +	}
>  end:
>  	return err;
>  }
> -- 
> 2.1.0
>
diff mbox

Patch

diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
index 29ccb36..e6757cd 100644
--- a/sound/firewire/oxfw/oxfw-stream.c
+++ b/sound/firewire/oxfw/oxfw-stream.c
@@ -171,9 +171,10 @@  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 (!amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT)) {
 		stop_stream(oxfw, stream);
+		err = -ETIMEDOUT;
+	}
 end:
 	return err;
 }