media: vimc: streamer: if kthread_stop fails, ignore the error
PATCH v3 1/1 media: vimc: streamer: if kthread_stop fails, ignore the error
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 run. This can happen if userspace calls streamon and streamoff right after.
---
changes since v2: add a comment explaning why we ignore the error
drivers/media/platform/vimc/vimc-streamer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/vimc/vimc-streamer.c +6 -2
@@ -215,9 +215,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,return 0 ; ret =kthread_stop (stream->kthread); -if (ret) -return ret; +/* +* ignore errors from kthread_stop since we have to set kthread +* to NULL and notify the subdevs that the stream stopped anyway +*/ +if (ret) +dev_warn (ved->dev,"kthread_stop returned '%d'\n" , ret); stream->kthread =NULL ;vimc_streamer_pipeline_terminate (stream);
Signature · 1 line
2.17.1
Quoted 20 lines · Dafna Hirschfeld
Ignore errors returned from
kthread_stopsince 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_stopcan return-EINTRin case the thread did not yet run. This can happen if userspace calls streamon and streamoff right after.Signed-off-by Dafna Hirschfeld <[email protected]>---
changes since v2: add a comment explaning why we ignore the errordrivers/media/platform/vimc/vimc-streamer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/media/platform/vimc/vimc-streamer.c +0
-0
drivers/media/platform/vimc/vimc-streamer.c int vimc_streamer_s_stream(struct vimc_stream *stream, · line 218
Quoted 6 lines
drivers/media/platform/vimc/vimc-streamer.c +0
-2@@ -215,9 +215,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,return 0 ; ret =kthread_stop (stream->kthread); -if (ret) -return ret;
this new line is not required
drivers/media/platform/vimc/vimc-streamer.c int vimc_streamer_s_stream(struct vimc_stream *stream, · line 222
Quoted 4 lines
drivers/media/platform/vimc/vimc-streamer.c +4
-0+/* +* ignore errors from kthread_stop since we have to set kthread +* to NULL and notify the subdevs that the stream stopped anyway +*/
hmm, I think what we could make it clear is in which situation kthread_stop would return an error.
How about:
"kthread_stop returns error in cases when streamon was immediately followed by streamoff, and the thread didn't had a chance to run.
Ignore errors to stop the stream in the pipeline."
Helen
Quoted 6 lines
drivers/media/platform/vimc/vimc-streamer.c +2
-0+if (ret) +dev_warn (ved->dev,"kthread_stop returned '%d'\n" , ret); stream->kthread =NULL ;vimc_streamer_pipeline_terminate (stream);