From dcf5893a70a79e60c57f492fbc7fc8a8e4b08c3a Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Thu, 15 Aug 2019 18:12:18 +0800 Subject: cpufreq: tegra186: fix hv mode error path If tegra_cpufreq_hv_mode is true and parse_hv_dt_data fails, we shouldn't go to err_free_res as platform resources are not allocated/mapped in case of hv mode. Also, we have not reached to the point to register_with_emc_bwmgr or get_lut_from_bpmp, so branching to err_free_res and ending up calling free_resources as well as free_shared_lut is incorrect. Bug 200512604 Change-Id: Ifb30e44c67b9eef22d2ef2e46fac33da7df5dc13 Signed-off-by: Leon Yu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2275514 GVS: Gerrit_Virtual_Submit Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sumit Gupta Reviewed-by: Puneet Saxena Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/cpufreq/tegra_cpufreq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/cpufreq') diff --git a/drivers/cpufreq/tegra_cpufreq.c b/drivers/cpufreq/tegra_cpufreq.c index 05e82c087..69f512c5c 100644 --- a/drivers/cpufreq/tegra_cpufreq.c +++ b/drivers/cpufreq/tegra_cpufreq.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -1324,6 +1324,9 @@ static int __init tegra186_cpufreq_probe(struct platform_device *pdev) if (of_device_is_compatible(dn, "nvidia,tegra18x-cpufreq-hv")) { tegra_cpufreq_hv_mode = true; pr_info("tegra18x-cpufreq: Using hv path\n"); + ret = parse_hv_dt_data(dn); + if (ret) + goto err_out; } else { res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(&pdev->dev, res); @@ -1344,11 +1347,6 @@ static int __init tegra186_cpufreq_probe(struct platform_device *pdev) spin_lock_init(&per_cpu(pcpu_slock, cpu)); } - if (tegra_cpufreq_hv_mode) { - ret = parse_hv_dt_data(dn); - if (ret) - goto err_free_res; - } tfreq_data.pcluster[B_CLUSTER].cluster_present = false; tfreq_data.pcluster[M_CLUSTER].cluster_present = false; for_each_possible_cpu(cpu) { -- cgit v1.2.2