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

Commit b22f9fa5 authored by Maheshwar Ajja's avatar Maheshwar Ajja Committed by Salman Syed
Browse files

msm: vidc: Remove unnecessary get/put_inst()



Without checking the get_inst() return type is leading to
wrongly destroying instance in put_inst() if return type
is NULL. get_inst() return type will be NULL if inst->session
was removed. No need to have get_inst() and put_inst() in
forward path because the instance will be present in
forward path always.

CRs-Fixed: 2177935
Change-Id: I8055a16652a65fdf83f48ab5b186b52ff1479e7f
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
Signed-off-by: default avatarSalman Syed <ssalman@codeaurora.org>
parent 098a0591
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -3839,13 +3839,17 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
		struct eos_buf *binfo = NULL;
		u32 smem_flags = SMEM_UNCACHED;

		get_inst(inst->core, inst);
		if (inst->state != MSM_VIDC_START_DONE) {
			dprintk(VIDC_DBG,
				"Inst = %pK is not ready for EOS\n", inst);
			break;
		}

		binfo = kzalloc(sizeof(*binfo), GFP_KERNEL);
		if (!binfo) {
			dprintk(VIDC_ERR, "%s: Out of memory\n", __func__);
			rc = -ENOMEM;
			goto exit;
			break;
		}

		if (inst->flags & VIDC_SECURE)
@@ -3855,26 +3859,25 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
				SZ_4K, 1, smem_flags,
				HAL_BUFFER_INPUT, 0, &binfo->smem);
		if (rc) {
			kfree(binfo);
			dprintk(VIDC_ERR,
				"Failed to allocate output memory\n");
			rc = -ENOMEM;
			goto exit;
			break;
		}

		mutex_lock(&inst->eosbufs.lock);
		list_add_tail(&binfo->list, &inst->eosbufs.list);
		mutex_unlock(&inst->eosbufs.lock);

		if (inst->state != MSM_VIDC_START_DONE) {
			dprintk(VIDC_DBG,
				"Inst = %pK is not ready for EOS\n", inst);
			goto exit;
		}

		rc = msm_vidc_send_pending_eos_buffers(inst);

exit:
		put_inst(inst);
		if (rc) {
			dprintk(VIDC_ERR,
				"Failed pending_eos_buffers sending\n");
			list_del(&binfo->list);
			kfree(binfo);
			break;
		}
		break;
	}
	default: