summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/ti-cpufreq.c
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2018-05-31 17:21:44 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-06-06 08:34:31 +0200
commitd7231f993ad4081da2c2784e2692617e2bd0551e (patch)
tree0abf38cfdf5606cfbf254f7cd62a7660baa10bb1 /drivers/cpufreq/ti-cpufreq.c
parente5d295b06d69a1924665a16a4987be475addd00f (diff)
downloadlinux-d7231f993ad4081da2c2784e2692617e2bd0551e.tar.gz
linux-d7231f993ad4081da2c2784e2692617e2bd0551e.tar.bz2
linux-d7231f993ad4081da2c2784e2692617e2bd0551e.zip
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: Suman Anna <s-anna@ti.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/ti-cpufreq.c')
-rw-r--r--drivers/cpufreq/ti-cpufreq.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 896caba5dfe5..3f0e2a14895a 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -217,7 +217,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
if (!match)
return -ENODEV;
- opp_data = kzalloc(sizeof(*opp_data), GFP_KERNEL);
+ opp_data = devm_kzalloc(&pdev->dev, sizeof(*opp_data), GFP_KERNEL);
if (!opp_data)
return -ENOMEM;
@@ -226,8 +226,7 @@ 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__);
- ret = -ENODEV;
- goto free_opp_data;
+ return -ENODEV;
}
opp_data->opp_node = dev_pm_opp_of_get_opp_desc_node(opp_data->cpu_dev);
@@ -285,8 +284,6 @@ register_cpufreq_dt:
fail_put_node:
of_node_put(opp_data->opp_node);
-free_opp_data:
- kfree(opp_data);
return ret;
}