summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-09-15 01:06:01 +0000
committerAndroid Partner Code Review <android-gerrit-partner@google.com>2023-09-15 01:06:01 +0000
commit81d1b63026d15e91768527b862ff0becbf900663 (patch)
tree978217a9e01fa1313d3453611431d4a33df18553
parent12b076d92245f022deda699f84db858d14b183a9 (diff)
parentdf7e074714a97b48cf58ded79b46cf1e39e3a71e (diff)
downloadcamera-kernel-android-msm-redbull-4.19-android14.tar.gz
Merge "msm: camera: smmu: Use get_file to increase ref count" into android-msm-pixel-4.19-udcandroid-14.0.0_r0.47android-14.0.0_r0.12android-msm-redbull-4.19-android14-releaseandroid-msm-redbull-4.19-android14
-rw-r--r--drivers/cam_req_mgr/cam_mem_mgr.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/cam_req_mgr/cam_mem_mgr.c b/drivers/cam_req_mgr/cam_mem_mgr.c
index 77622e2..d106741 100644
--- a/drivers/cam_req_mgr/cam_mem_mgr.c
+++ b/drivers/cam_req_mgr/cam_mem_mgr.c
@@ -402,7 +402,6 @@ static int cam_mem_util_get_dma_buf_fd(size_t len,
struct dma_buf **buf,
int *fd)
{
- struct dma_buf *dmabuf = NULL;
int rc = 0;
struct timespec64 ts1, ts2;
long microsec = 0;
@@ -418,23 +417,18 @@ static int cam_mem_util_get_dma_buf_fd(size_t len,
*buf = ion_alloc(len, heap_id_mask, flags);
if (IS_ERR_OR_NULL(*buf))
return -ENOMEM;
-
- *fd = dma_buf_fd(*buf, O_CLOEXEC);
- if (*fd < 0) {
- CAM_ERR(CAM_MEM, "get fd fail, *fd=%d", *fd);
- rc = -EINVAL;
- goto get_fd_fail;
- }
-
/*
* increment the ref count so that ref count becomes 2 here
* when we close fd, refcount becomes 1 and when we do
* dmap_put_buf, ref count becomes 0 and memory will be freed.
*/
- dmabuf = dma_buf_get(*fd);
- if (IS_ERR_OR_NULL(dmabuf)) {
- CAM_ERR(CAM_MEM, "dma_buf_get failed, *fd=%d", *fd);
+ get_dma_buf(*buf);
+
+ *fd = dma_buf_fd(*buf, O_CLOEXEC);
+ if (*fd < 0) {
+ CAM_ERR(CAM_MEM, "get fd fail, *fd=%d", *fd);
rc = -EINVAL;
+ goto get_fd_fail;
}
if (tbl.alloc_profile_enable) {