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

Commit 6854e171 authored by Shi Zhongbo's avatar Shi Zhongbo
Browse files

msm: vidc: fix kw issues



Fix two kw issues on uninitialized pointer
and possible NULL dereference.

Change-Id: Ic87335d435ee84bef1c264d99e0d857d2932cbdc
Signed-off-by: default avatarShi Zhongbo <zhongbos@codeaurora.org>
parent cd68fa55
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -746,6 +746,13 @@ static int msm_vidc_get_extra_input_buff_count(struct msm_vidc_inst *inst)
	struct msm_vidc_core *core;
	struct v4l2_format *f;

	if (!inst || !inst->core) {
		dprintk(VIDC_ERR, "%s: invalid params\n", __func__);
		return -EINVAL;
	}

	core = inst->core;

	/*
	 * For a non-realtime session, extra buffers are not required.
	 * For thumbnail session, extra buffers are not required as
@@ -815,6 +822,13 @@ static int msm_vidc_get_extra_output_buff_count(struct msm_vidc_inst *inst)
	struct msm_vidc_core *core;
	struct v4l2_format *f;

	if (!inst || !inst->core) {
		dprintk(VIDC_ERR, "%s: invalid params\n", __func__);
		return -EINVAL;
	}

	core = inst->core;

	/*
	 * For a non-realtime session, extra buffers are not required.
	 * For thumbnail session, extra buffers are not required as
@@ -840,7 +854,7 @@ static int msm_vidc_get_extra_output_buff_count(struct msm_vidc_inst *inst)
		 */
		if (core->resources.decode_batching)
			extra_output_count = BATCH_DEC_EXTRA_OUTPUT_BUFFERS;
		else if (inst->core->resources.dcvs)
		else if (core->resources.dcvs)
			extra_output_count = DCVS_DEC_EXTRA_OUTPUT_BUFFERS;
	} else if (is_encode_session(inst)) {
		/*
+1 −1
Original line number Diff line number Diff line
@@ -4588,7 +4588,7 @@ int msm_comm_qbufs_batch(struct msm_vidc_inst *inst,
	struct msm_vidc_buffer *buf;
	int do_bw_calc = 0;

	do_bw_calc = mbuf->vvb.vb2_buf.type == INPUT_MPLANE;
	do_bw_calc = mbuf ? mbuf->vvb.vb2_buf.type == INPUT_MPLANE : 0;
	rc = msm_comm_scale_clocks_and_bus(inst, do_bw_calc);
	if (rc)
		dprintk(VIDC_ERR, "%s: scale clock & bw failed\n", __func__);