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

Commit 411fe691 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Fix memory leak and array abounds exceeding issues"

parents 254a6a70 69639bd4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -827,6 +827,11 @@ static unsigned long __calculate(struct vidc_bus_vote_data *d,
		[HAL_VIDEO_DOMAIN_DECODER] = __calculate_decoder,
	};

	if (d->domain >= ARRAY_SIZE(calc)) {
		dprintk(VIDC_ERR, "%s: invalid domain %d\n",
			__func__, d->domain);
		return 0;
	}
	return calc[d->domain](d, gm);
}

+10 −8
Original line number Diff line number Diff line
@@ -131,8 +131,10 @@ static struct v4l2_ctrl **get_super_cluster(struct msm_vidc_inst *inst,
	struct v4l2_ctrl **cluster = kmalloc(sizeof(struct v4l2_ctrl *) *
			num_ctrls, GFP_KERNEL);

	if (!cluster || !inst)
	if (!cluster || !inst) {
		kfree(cluster);
		return NULL;
	}

	for (c = 0; c < num_ctrls; c++)
		cluster[c] =  inst->ctrls[c];
@@ -985,9 +987,7 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data)
	complete(&(core->completions[index]));
}

static void put_inst(struct msm_vidc_inst *inst)
{
	void put_inst_helper(struct kref *kref)
static void put_inst_helper(struct kref *kref)
{
	struct msm_vidc_inst *inst = container_of(kref,
			struct msm_vidc_inst, kref);
@@ -995,6 +995,8 @@ static void put_inst(struct msm_vidc_inst *inst)
	msm_vidc_destroy(inst);
}

static void put_inst(struct msm_vidc_inst *inst)
{
	if (!inst)
		return;

+8 −8
Original line number Diff line number Diff line
@@ -371,20 +371,20 @@ static int msm_vidc_load_platform_version_table(
	return 0;
}

static int msm_vidc_load_allowed_clocks_table(
		struct msm_vidc_platform_resources *res)
{
	int rc = 0;
	struct platform_device *pdev = res->pdev;

/* A comparator to compare loads (needed later on) */
	int cmp(const void *a, const void *b)
static int cmp(const void *a, const void *b)
{
	/* want to sort in reverse so flip the comparison */
	return ((struct allowed_clock_rates_table *)b)->clock_rate -
		((struct allowed_clock_rates_table *)a)->clock_rate;
}

static int msm_vidc_load_allowed_clocks_table(
		struct msm_vidc_platform_resources *res)
{
	int rc = 0;
	struct platform_device *pdev = res->pdev;

	if (!of_find_property(pdev->dev.of_node,
			"qcom,allowed-clock-rates", NULL)) {
		dprintk(VIDC_DBG, "qcom,allowed-clock-rates not found\n");