diff mbox series

media: vimc: streamer: if kthread_stop fails, ignore the error

Message ID 20200113185934.15722-2-dafna.hirschfeld@collabora.com (mailing list archive)
State New, archived
Headers show
Series media: vimc: streamer: if kthread_stop fails, ignore the error | expand

Commit Message

Dafna Hirschfeld Jan. 13, 2020, 6:59 p.m. UTC
Ignore errors returned from kthread_stop since the
vimc subdevices should still be notified that
streaming stopped so they can release the memory for
the streaming, and also kthread should be set to NULL.
kthread_stop can return -EINTR in case the thread
did not yet ran. This can happen if userspace calls
streamon and streamoff right after.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 drivers/media/platform/vimc/vimc-streamer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Helen Mae Koike Fornazier Jan. 13, 2020, 11:09 p.m. UTC | #1
On 1/13/20 4:59 PM, Dafna Hirschfeld wrote:
> Ignore errors returned from kthread_stop since the
> vimc subdevices should still be notified that
> streaming stopped so they can release the memory for
> the streaming, and also kthread should be set to NULL.
> kthread_stop can return -EINTR in case the thread
> did not yet ran. This can happen if userspace calls
> streamon and streamoff right after.
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> ---
>  drivers/media/platform/vimc/vimc-streamer.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
> index cd6b55433c9e..5c5d3c068398 100644
> --- a/drivers/media/platform/vimc/vimc-streamer.c
> +++ b/drivers/media/platform/vimc/vimc-streamer.c
> @@ -216,8 +216,7 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
>  
>  		ret = kthread_stop(stream->kthread);

Could you add a comment here too? To make it clean in the code why we are ignoring this error?

>  		if (ret)
> -			return ret;
> -

No need to remove this line.

> +			dev_warn(ved->dev, "kthread_stop returned '%d'\n", ret);
>  		stream->kthread = NULL;
>  
>  		vimc_streamer_pipeline_terminate(stream);
> 

Thanks
Helen
diff mbox series

Patch

diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
index cd6b55433c9e..5c5d3c068398 100644
--- a/drivers/media/platform/vimc/vimc-streamer.c
+++ b/drivers/media/platform/vimc/vimc-streamer.c
@@ -216,8 +216,7 @@  int vimc_streamer_s_stream(struct vimc_stream *stream,
 
 		ret = kthread_stop(stream->kthread);
 		if (ret)
-			return ret;
-
+			dev_warn(ved->dev, "kthread_stop returned '%d'\n", ret);
 		stream->kthread = NULL;
 
 		vimc_streamer_pipeline_terminate(stream);