Skip to content

Commit

Permalink
cpufreq: ti-cpufreq: fix memory leak in ti_cpufreq_probe()
Browse files Browse the repository at this point in the history
Similar to commit<05829d9431df>("cpufreq: ti-cpufreq: kfree opp_data when failure"), opp_data needs to be freed when failure, including fail_put_node.

Signed-off-by: Defang Bo <bodefang@126.com>
  • Loading branch information
Defang Bo authored and intel-lab-lkp committed Oct 19, 2020
1 parent 91e0225 commit 5a1fa3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/cpufreq/ti-cpufreq.c
Expand Up @@ -342,7 +342,8 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
opp_data->cpu_dev = get_cpu_device(0);
if (!opp_data->cpu_dev) {
pr_err("%s: Failed to get device for CPU0\n", __func__);
return -ENODEV;
ret = ENODEV;
goto free_opp_data;
}

opp_data->opp_node = dev_pm_opp_of_get_opp_desc_node(opp_data->cpu_dev);
Expand Down Expand Up @@ -404,7 +405,8 @@ static int ti_cpufreq_probe(struct platform_device *pdev)

fail_put_node:
of_node_put(opp_data->opp_node);

free_opp_data:
kfree(opp_data)
return ret;
}

Expand Down

0 comments on commit 5a1fa3f

Please sign in to comment.