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

Commit 943b84a8 authored by Devesh Jhunjhunwala's avatar Devesh Jhunjhunwala
Browse files

clk: msm: Fix a bug in the derive_device_list api



If the cpu device_node is found and added to the device_list,
do not attempt to find the platform_device node. Also, initialize
the device_list entries to null at the beginning of the for loop
to prevent the if check from evaluating to true even when
get_cpu_device fails or the dev_node does not match the cpu_node.

Change-Id: If099f78c6582ca67e9e00dd271d0b52dd67c2157
Signed-off-by: default avatarDevesh Jhunjhunwala <deveshj@codeaurora.org>
parent 61692529
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1071,6 +1071,7 @@ static struct device **derive_device_list(struct clk *clk,
		return ERR_PTR(-ENOMEM);

	for (j = 0; j < count; j++) {
		device_list[j] = NULL;
		dev_node = of_parse_phandle(np, clk_handle_name, j);
		if (!dev_node) {
			pr_err("Unable to get device_node pointer for %s opp-handle (%s)\n",
@@ -1081,10 +1082,12 @@ static struct device **derive_device_list(struct clk *clk,
		for_each_possible_cpu(cpu) {
			if (of_get_cpu_node(cpu, NULL) == dev_node) {
				device_list[j] = get_cpu_device(cpu);
				continue;
			}
		}

		if (device_list[j])
			continue;

		pdev = of_find_device_by_node(dev_node);
		if (!pdev) {
			pr_err("Unable to find platform_device node for %s opp-handle\n",