Media:Wave5: Fix segment fault when finish buffer
authorSom Qin <som.qin@starfivetech.com>
Tue, 29 Aug 2023 02:18:47 +0000 (10:18 +0800)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 19 Feb 2024 00:14:04 +0000 (09:14 +0900)
Signed-off-by: Som Qin <som.qin@starfivetech.com>
[sw0312.kim: cherry-pick the commit 9aea96f91ea6 from https://github.com/starfive-tech/linux/tree/JH7110_VisionFive2_6.1.y_devel]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ic2bf17247ed6ec08582d5b98b4e0be24d6a07ce0

drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c

index 481273d9ceb362a58f6ad26838f18f17256cf892..fda9090315a6d20a2b61f16cce604efa2d0363c9 100644 (file)
@@ -316,6 +316,11 @@ static void wave5_vpu_dec_finish_decode(struct vpu_instance *inst)
                                v4l2_m2m_dst_buf_remove_by_idx(inst->v4l2_fh.m2m_ctx,
                                                               dec_output_info.index_frame_display);
 
+                       if (!dst_buf) {
+                               dev_dbg(inst->dev->dev,"find no dst_buf \n");
+                               return;
+                       }
+
                        stride = dec_output_info.disp_frame.stride;
                        height = dec_output_info.disp_pic_height -
                                dec_output_info.rc_display.bottom;