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

Commit 46f8d897 authored by Maulik Shah's avatar Maulik Shah Committed by Gerrit - the friendly Code Review server
Browse files

lpm-levels: Remove kfree for memory allocated with devm_kzalloc



Do not use kfree for memory allocated with devm_kzalloc during
failures as device memory will get freed in device release.

Change-Id: I6c4d3f8ed55ab02e3e70a1fe65452a8817c8b64e
Signed-off-by: default avatarMaulik Shah <mkshah@codeaurora.org>
parent 2b6a49e9
Loading
Loading
Loading
Loading
+6 −20
Original line number Diff line number Diff line
@@ -709,7 +709,7 @@ static int parse_cpu(struct device_node *node, struct lpm_cpu *cpu)

static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)
{
	int ret, i;
	int ret;
	char *key;
	struct lpm_cpu *cpu;

@@ -725,12 +725,12 @@ static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)
	key = "qcom,psci-mode-shift";
	ret = of_property_read_u32(node, key, &cpu->psci_mode_shift);
	if (ret)
		goto failed_parse_params;
		goto failed;

	key = "qcom,psci-mode-mask";
	ret = of_property_read_u32(node, key, &cpu->psci_mode_mask);
	if (ret)
		goto failed_parse_params;
		goto failed;

	key = "qcom,disable-prediction";
	cpu->lpm_prediction = !(of_property_read_bool(node, key));
@@ -758,20 +758,14 @@ static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)
	key = "parse_cpu";
	ret = parse_cpu(node, cpu);
	if (ret)
		goto failed_parse_cpu;
		goto failed;

	cpumask_or(&c->child_cpus, &c->child_cpus, &cpu->related_cpus);
	list_add(&cpu->list, &c->cpu);

	return ret;

failed_parse_cpu:
	for (i = 0; i < cpu->nlevels; i++) {
		kfree(cpu->levels[i].name);
		cpu->levels[i].name = NULL;
	}

failed_parse_params:
failed:
	pr_err("Failed to read key: %s node: %s\n", key, node->name);
	return ret;
}
@@ -786,15 +780,8 @@ void free_cluster_node(struct lpm_cluster *cluster)
		free_cluster_node(cl);
	};

	list_for_each_entry_safe(cpu, n, &cluster->cpu, list) {
		int i;

	list_for_each_entry_safe(cpu, n, &cluster->cpu, list)
		list_del(&cpu->list);
		for (i = 0; i < cpu->nlevels; i++) {
			kfree(cpu->levels[i].name);
			cpu->levels[i].name = NULL;
		}
	}
}

/*
@@ -886,7 +873,6 @@ struct lpm_cluster *parse_cluster(struct device_node *node,
		list_del(&c->list);
	free_cluster_node(c);
failed_parse_params:
	c->parent = NULL;
	pr_err("Failed parse params\n");
	return NULL;
}