Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 565357d9 authored by Kiran Kumar H N's avatar Kiran Kumar H N Committed by Stephen Boyd
Browse files

msm: camera: Add some minor code fixes.



Add couple of valid ptr checks and zero out
variables after allocation.

Change-Id: Ib0e80eab9ac41cec192d1c4a04f8aeafd77729a3
Signed-off-by: default avatarKiran Kumar H N <hurlisal@codeaurora.org>
parent fdc3fb03
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@ int msm_gemini_evt_get(struct msm_gemini_device *pgmn_dev,
		return -EAGAIN;
	}

	memset(&ctrl_cmd, 0, sizeof(struct msm_gemini_ctrl_cmd));
	ctrl_cmd.type = buf_p->vbuf.type;
	kfree(buf_p);

+4 −1
Original line number Diff line number Diff line
@@ -888,7 +888,10 @@ static int msm_open(struct file *f)
			goto msm_cam_server_begin_session_failed;
		}
		pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);

		if (!pmctl) {
			pr_err("%s mctl ptr is null ", __func__);
			goto msm_cam_server_begin_session_failed;
		}
#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
		pmctl->client = msm_ion_client_create(-1, "camera");
		kref_init(&pmctl->refcount);
+9 −1
Original line number Diff line number Diff line
@@ -437,7 +437,7 @@ static int msm_mctl_open(struct msm_cam_media_controller *p_mctl,
	/* open sub devices - once only*/
	if (!p_mctl->opencnt) {
		struct msm_sensor_csi_info csi_info;
		uint32_t csid_version;
		uint32_t csid_version = 0;
		wake_lock(&p_mctl->wake_lock);

		csid_core = camdev->csid_core;
@@ -1327,6 +1327,10 @@ static int msm_mctl_v4l2_s_fmt_cap(struct file *f, void *pctx,
	WARN_ON(pctx != f->private_data);

	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
	if (!pmctl) {
		pr_err("%s mctl ptr is null ", __func__);
		return -EINVAL;
	}
	if (!pcam_inst->vbqueue_initialized) {
		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
					V4L2_BUF_TYPE_VIDEO_CAPTURE);
@@ -1351,6 +1355,10 @@ static int msm_mctl_v4l2_s_fmt_cap_mplane(struct file *f, void *pctx,
	WARN_ON(pctx != f->private_data);

	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
	if (!pmctl) {
		pr_err("%s mctl ptr is null ", __func__);
		return -EINVAL;
	}
	if (!pcam_inst->vbqueue_initialized) {
		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
					V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+4 −1
Original line number Diff line number Diff line
@@ -4754,6 +4754,7 @@ int msm_axi_subdev_init(struct v4l2_subdev *sd)

	return rc;
clk_enable_failed:
	if (axi_ctrl->fs_vfe)
		regulator_disable(axi_ctrl->fs_vfe);
fs_failed:
	iounmap(axi_ctrl->share_ctrl->vfebase);
@@ -4932,12 +4933,14 @@ static int msm_axi_config(struct v4l2_subdev *sd, void __user *arg)
		pr_err("%s: base address unmapped\n", __func__);
		return -EFAULT;
	}
	memset(&cfgcmd, 0, sizeof(struct msm_vfe_cfg_cmd));
	if (NULL != arg) {
		if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
			ERR_COPY_FROM_USER();
			return -EFAULT;
		}
	}
	memset(&vfecmd, 0, sizeof(struct msm_isp_cmd));
	if (NULL != cfgcmd.value) {
		if (copy_from_user(&vfecmd,
				(void __user *)(cfgcmd.value),
+2 −1
Original line number Diff line number Diff line
@@ -545,6 +545,7 @@ int vpe_enable(uint32_t clk_rate)
	return rc;

vpe_clk_failed:
	if (vpe_ctrl->fs_vpe)
		regulator_disable(vpe_ctrl->fs_vpe);
vpe_fs_failed:
	disable_irq(vpe_ctrl->vpeirq->start);
Loading