media: mediatek: vcodec: Return NULL if no vdec_fb is found
authorIrui Wang <irui.wang@mediatek.com>
Wed, 5 Jul 2023 09:14:41 +0000 (17:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:51 +0000 (09:42 +0200)
[ Upstream commit dfa2d6e07432270330ae191f50a0e70636a4cd2b ]

"fb_use_list" is used to store used or referenced frame buffers for
vp9 stateful decoder. "NULL" should be returned when getting target
frame buffer failed from "fb_use_list", not a random unexpected one.

Fixes: f77e89854b3e ("[media] vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver")
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c

index 70b8383f7c8ec3aa45697cde0562717387f92181..a27a109d8d14430001c02de168552e1485e56d8d 100644 (file)
@@ -226,10 +226,11 @@ static struct vdec_fb *vp9_rm_from_fb_use_list(struct vdec_vp9_inst
                if (fb->base_y.va == addr) {
                        list_move_tail(&node->list,
                                       &inst->available_fb_node_list);
-                       break;
+                       return fb;
                }
        }
-       return fb;
+
+       return NULL;
 }
 
 static void vp9_add_to_fb_free_list(struct vdec_vp9_inst *inst,