* [patch] ALSA: oxfw: fix a condition in start_stream()
@ 2015-02-26 20:32 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-02-26 20:32 UTC (permalink / raw)
To: Clemens Ladisch, Takashi Sakamoto
Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel-janitors
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>
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;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch] ALSA: oxfw: fix a condition in start_stream()
@ 2015-02-26 20:32 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-02-26 20:32 UTC (permalink / raw)
To: Clemens Ladisch, Takashi Sakamoto
Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel-janitors
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>
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;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch] ALSA: oxfw: fix a condition in start_stream()
2015-02-26 20:32 ` Dan Carpenter
@ 2015-02-27 0:36 ` Takashi Sakamoto
-1 siblings, 0 replies; 6+ messages in thread
From: Takashi Sakamoto @ 2015-02-27 0:36 UTC (permalink / raw)
To: Dan Carpenter, Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel, kernel-janitors
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;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] ALSA: oxfw: fix a condition in start_stream()
@ 2015-02-27 0:36 ` Takashi Sakamoto
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Sakamoto @ 2015-02-27 0:36 UTC (permalink / raw)
To: Dan Carpenter, Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel, kernel-janitors
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;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ALSA: oxfw: fix a condition and return code in start_stream()
2015-02-26 20:32 ` Dan Carpenter
(?)
(?)
@ 2015-02-27 0:39 ` Takashi Sakamoto
2015-02-27 13:43 ` Takashi Iwai
-1 siblings, 1 reply; 6+ messages in thread
From: Takashi Sakamoto @ 2015-02-27 0:39 UTC (permalink / raw)
To: clemens, tiwai; +Cc: alsa-devel, dan.carpenter
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(-)
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: oxfw: fix a condition and return code in start_stream()
2015-02-27 0:39 ` [PATCH] ALSA: oxfw: fix a condition and return code " Takashi Sakamoto
@ 2015-02-27 13:43 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2015-02-27 13:43 UTC (permalink / raw)
To: Takashi Sakamoto; +Cc: alsa-devel, clemens, dan.carpenter
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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-02-27 13:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 20:32 [patch] ALSA: oxfw: fix a condition in start_stream() Dan Carpenter
2015-02-26 20:32 ` Dan Carpenter
2015-02-27 0:36 ` Takashi Sakamoto
2015-02-27 0:36 ` Takashi Sakamoto
2015-02-27 0:39 ` [PATCH] ALSA: oxfw: fix a condition and return code " Takashi Sakamoto
2015-02-27 13:43 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.