media: mfc: add missed put_dmabuf
authorSunyoung Kang <sy0816.kang@samsung.com>
Thu, 9 Nov 2017 08:20:24 +0000 (17:20 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:21 +0000 (20:22 +0300)
When using dmabuf container, put_dmabuf() was missed and it is
memory leak. So this adds put_dmabuf().

Change-Id: Ib0cf13f99409cebff5d5ca9af6a3c424776061ba
Signed-off-by: Sunyoung Kang <sy0816.kang@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c

index 56c8d61587cf334034a0afde9e4995b57c49f831..a1d954533f89bfd8de03ddd404710717f4d71e62 100644 (file)
@@ -161,6 +161,7 @@ static int s5p_mfc_enc_buf_init(struct vb2_buffer *vb)
 
                                count = s5p_mfc_bufcon_get_daddr(ctx, buf, dmabuf, i);
                                if (count != ctx->num_bufs_in_vb) {
+                                       s5p_mfc_mem_put_dmabuf(dmabuf);
                                        mfc_err_ctx("invalid buffer count %d != num_bufs_in_vb %d\n",
                                                        count, ctx->num_bufs_in_vb);
                                        return -EFAULT;
@@ -170,6 +171,7 @@ static int s5p_mfc_enc_buf_init(struct vb2_buffer *vb)
                        } else {
                                dma_addr_t start_raw;
 
+                               s5p_mfc_mem_put_dmabuf(dmabuf);
                                start_raw = s5p_mfc_mem_get_daddr_vb(vb, 0);
                                if (start_raw == 0) {
                                        mfc_err_ctx("Plane mem not allocated.\n");