Commit d7231f99 authored by Suman Anna's avatar Suman Anna Committed by Rafael J. Wysocki

cpufreq: ti-cpufreq: Use devres managed API in probe()

The ti_cpufreq_probe() function uses regular kzalloc to allocate
the ti_cpufreq_data structure and kfree for freeing this memory
on failures. Simplify this code by using the devres managed
API.
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e5d295b0
...@@ -217,7 +217,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev) ...@@ -217,7 +217,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
if (!match) if (!match)
return -ENODEV; return -ENODEV;
opp_data = kzalloc(sizeof(*opp_data), GFP_KERNEL); opp_data = devm_kzalloc(&pdev->dev, sizeof(*opp_data), GFP_KERNEL);
if (!opp_data) if (!opp_data)
return -ENOMEM; return -ENOMEM;
...@@ -226,8 +226,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev) ...@@ -226,8 +226,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
opp_data->cpu_dev = get_cpu_device(0); opp_data->cpu_dev = get_cpu_device(0);
if (!opp_data->cpu_dev) { if (!opp_data->cpu_dev) {
pr_err("%s: Failed to get device for CPU0\n", __func__); pr_err("%s: Failed to get device for CPU0\n", __func__);
ret = -ENODEV; return -ENODEV;
goto free_opp_data;
} }
opp_data->opp_node = dev_pm_opp_of_get_opp_desc_node(opp_data->cpu_dev); opp_data->opp_node = dev_pm_opp_of_get_opp_desc_node(opp_data->cpu_dev);
...@@ -285,8 +284,6 @@ static int ti_cpufreq_probe(struct platform_device *pdev) ...@@ -285,8 +284,6 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
fail_put_node: fail_put_node:
of_node_put(opp_data->opp_node); of_node_put(opp_data->opp_node);
free_opp_data:
kfree(opp_data);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment