From faef6bbca74dcfe02e0840777c8f6b3806041227 Mon Sep 17 00:00:00 2001 From: Manish Poddar Date: Wed, 23 Mar 2016 16:57:23 +0530 Subject: msm: camera: Initialize variables to default Add NULL check and initialize the variables to default values in camera. CRs-fixed: 994317 Change-Id: I165f1c39c1332737a644c6650bc40f4c718a7ee8 Signed-off-by: Manish Poddar --- drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c | 5 +++++ drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c | 2 +- drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c index 3e3143be0a13..b045d6c6e8da 100644 --- a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c +++ b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c @@ -972,6 +972,11 @@ static int cam_smmu_map_buffer_and_add_to_list(int idx, int ion_fd, struct dma_buf_attachment *attach = NULL; struct sg_table *table = NULL; + if (!paddr_ptr) { + rc = -EINVAL; + goto err_out; + } + /* allocate memory for each buffer information */ buf = dma_buf_get(ion_fd); if (IS_ERR_OR_NULL(buf)) { diff --git a/drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c b/drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c index 1cfb7a3dfa00..4deda8da3871 100644 --- a/drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c +++ b/drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c @@ -540,7 +540,7 @@ static long msm_fd_private_ioctl(struct file *file, void *fh, struct fd_ctx *ctx = msm_fd_ctx_from_fh(fh); struct msm_fd_stats *stats; int stats_idx; - int ret; + int ret = -EINVAL; int i; switch (cmd) { diff --git a/drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c b/drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c index 760a59d15a31..21d42a77accb 100644 --- a/drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c +++ b/drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c @@ -965,7 +965,7 @@ void msm_fd_hw_put(struct msm_fd_device *fd) */ static int msm_fd_hw_attach_iommu(struct msm_fd_device *fd) { - int ret; + int ret = -EINVAL; mutex_lock(&fd->lock); -- cgit v1.2.3