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

Commit 2e7ced2f authored by Mansur Alisha Shaik's avatar Mansur Alisha Shaik
Browse files

msm: vidc: Fix for KW error



temp_ctrl may explicitly dereference NULL value
returned by get_ctrl_from_cluster.
So added NULL check to avoid runtime errors.

Change-Id: Ibb1cc56fe18d11f2d15f02178c5fb6164b034572
Signed-off-by: default avatarMansur Alisha Shaik <mansur@codeaurora.org>
parent 98cddae6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2491,6 +2491,11 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_LEVEL);
		if (!temp_ctrl) {
			dprintk(VIDC_ERR,
				"failed to get control\n");
			return -EINVAL;
		}
		property_id =
			HAL_PARAM_PROFILE_LEVEL_CURRENT;
		profile_level.profile = vdec_v4l2_to_hal(ctrl->id,
@@ -2502,6 +2507,11 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_PROFILE);
		if (!temp_ctrl) {
			dprintk(VIDC_ERR,
				"failed to get control\n");
			return -EINVAL;
		}
		property_id =
			HAL_PARAM_PROFILE_LEVEL_CURRENT;
		profile_level.level = vdec_v4l2_to_hal(ctrl->id,
+15 −0
Original line number Diff line number Diff line
@@ -2320,6 +2320,11 @@ static int msm_venc_validate_qp_value(struct msm_vidc_inst *inst,
	switch (inst->fmts[CAPTURE_PORT].fourcc) {
	case V4L2_PIX_FMT_VP8:
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_VPX_MAX_QP);
		if (!temp_ctrl) {
			dprintk(VIDC_ERR,
				"failed to get control");
			return -EINVAL;
		}
		max = temp_ctrl->maximum;
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_VPX_MIN_QP);
		min = temp_ctrl->minimum;
@@ -2329,6 +2334,11 @@ static int msm_venc_validate_qp_value(struct msm_vidc_inst *inst,
	case V4L2_PIX_FMT_H263:
	case V4L2_PIX_FMT_MPEG4:
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP);
		if (!temp_ctrl) {
			dprintk(VIDC_ERR,
				"failed to get control");
			return -EINVAL;
		}
		max = temp_ctrl->maximum;
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP);
		min = temp_ctrl->minimum;
@@ -2338,6 +2348,11 @@ static int msm_venc_validate_qp_value(struct msm_vidc_inst *inst,
	case V4L2_PIX_FMT_H264:
	case V4L2_PIX_FMT_HEVC:
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_MAX_QP);
		if (!temp_ctrl) {
			dprintk(VIDC_ERR,
				"failed to get control");
			return -EINVAL;
		}
		max = temp_ctrl->maximum;
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_MIN_QP);
		min = temp_ctrl->minimum;