This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] s5p-mfc: fix encoder crash after VIDIOC_STREAMOFF
Author:  John Sheu <[email protected]>
Date:    Tue Mar 11 19:52:02 2014 -0300

VIDIOC_STREAMOFF clears the encoder's destination queue -- routines run
from the interrupt handler cannot assume that the queue is non-empty.

Signed-off-by: John Sheu <[email protected]>
Signed-off-by: Kamil Debski <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=e933cefa0f6e9cf40c8f4ae6d4da8ebb3f765ba0

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 458279e..704e37c 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -772,13 +772,16 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
 
        if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) {
                spin_lock_irqsave(&dev->irqlock, flags);
-               dst_mb = list_entry(ctx->dst_queue.next,
-                               struct s5p_mfc_buf, list);
-               list_del(&dst_mb->list);
-               ctx->dst_queue_cnt--;
-               vb2_set_plane_payload(dst_mb->b, 0,
-                       s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev));
-               vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE);
+               if (!list_empty(&ctx->dst_queue)) {
+                       dst_mb = list_entry(ctx->dst_queue.next,
+                                       struct s5p_mfc_buf, list);
+                       list_del(&dst_mb->list);
+                       ctx->dst_queue_cnt--;
+                       vb2_set_plane_payload(dst_mb->b, 0,
+                               s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size,
+                                               dev));
+                       vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE);
+               }
                spin_unlock_irqrestore(&dev->irqlock, flags);
        }
 
@@ -883,8 +886,7 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
                mfc_debug(2, "enc src count: %d, enc ref count: %d\n",
                          ctx->src_queue_cnt, ctx->ref_queue_cnt);
        }
-       if (strm_size > 0) {
-               /* at least one more dest. buffers exist always  */
+       if ((ctx->dst_queue_cnt > 0) && (strm_size > 0)) {
                mb_entry = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf,
                                                                        list);
                list_del(&mb_entry->list);

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to