From 0439e8d3fe98cb4a75019d7366a9fb49666be623 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Fri, 25 May 2018 20:33:41 +0900 Subject: [PATCH] fimc-is-2: move to the new dma-buf-container The new, working dma-buf-container is introduced by the commit ee1d9055d ('dma-buf: introduce dma-buf container'). It still supports the same API functions but the contexts are slightly changed because the design of dma-buf-container is changed. Specifically, dmabuf_container_get_count() now returns -EINVAL instead of 0 for the dma-bufs that is not a dma-buf-container. This change of return value comes from the fact that dma-buf-container allows having no dma-buf by its design although it is impossible to create an empty dma-buf-container in practice. Change-Id: I8c8c6698a513e6c18bbc43a4734594a484028699 Signed-off-by: Cho KyongHo --- .../platform/exynos/fimc-is2/fimc-is-video.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-video.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-video.c index a9b936dbe588..3084039c88a2 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-video.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-video.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -944,6 +944,22 @@ int fimc_is_queue_buffer_queue(struct fimc_is_queue *queue, /* get the buffer count in the dmabuf_container */ batch_size = dmabuf_container_get_count(dmabuf); + if (batch_size == 0) { + /* + * FIXME: exiting this function here causes leak of + * dma-bufs. This also applies to the above return + * statement and all 'goto exit' statements below. + * Please fix this by the right person in charge. + */ + err("%s Empty dmabuf-container of fd %d\n", __func__, + vb->planes[i].m.fd); + dma_buf_put(dmabuf); + return (u32)-ENOMEM; + } + + if (batch_size < 0) + batch_size = 0; + if (batch_size > 0) { /* traverse and check the buffers in dmabuf_container */ for (buf_i = 0; buf_i < batch_size; buf_i++) { -- 2.20.1