RE: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver
From: <hidden>
Date: 2018-05-17 08:20:57
Also in:
linux-arm-kernel, linux-arm-msm, linux-clk, linux-pm, lkml
-----Original Message----- From: ilialin@codeaurora.org <redacted> Sent: Thursday, May 17, 2018 10:51 To: 'Viresh Kumar' <viresh.kumar@linaro.org>; 'Amit Kucheria' [off-list ref] Cc: 'Michael Turquette' <mturquette@baylibre.com>; 'sboyd@kernel.org' [off-list ref]; 'Rob Herring' [off-list ref]; 'Mark Rutland' [off-list ref]; 'nm@ti.com' [off-list ref]; 'lgirdwood@gmail.com' [off-list ref]; 'broonie@kernel.org' [off-list ref]; 'Andy Gross' [off-list ref]; 'David Brown' [off-list ref]; 'catalin.marinas@arm.com' [off-list ref]; 'will.deacon@arm.com' [off-list ref]; 'Rafael J. Wysocki' [off-list ref]; 'linux- clk@vger.kernel.org' [off-list ref]; 'devicetree@vger.kernel.org' [off-list ref]; 'LKML' <linux- kernel@vger.kernel.org>; 'Linux PM list' [off-list ref];
'linux-
arm-msm@vger.kernel.org' [off-list ref]; 'linux- soc@vger.kernel.org' [off-list ref]; 'lakml' <linux-arm- kernel@lists.infradead.org>; 'Rajendra Nayak' [off-list ref]; 'nicolas.dechesne@linaro.org' [off-list ref]; 'celster@codeaurora.org' [off-list ref]; 'tfinkel@codeaurora.org' [off-list ref] Subject: RE: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driverquoted
-----Original Message----- From: Viresh Kumar <viresh.kumar@linaro.org> Sent: Wednesday, May 16, 2018 17:12 To: Amit Kucheria <redacted> Cc: Ilia Lin <redacted>; Michael Turquette [off-list ref]; sboyd@kernel.org; Rob Herring [off-list ref]; Mark Rutland [off-list ref]; nm@ti.com; lgirdwood@gmail.com; broonie@kernel.org; Andy Gross [off-list ref]; David Brown [off-list ref]; catalin.marinas@arm.com; will.deacon@arm.com; Rafael J. Wysocki [off-list ref]; linux-clk@vger.kernel.org; devicetree@vger.kernel.org; LKML [off-list ref]; Linux PM list [off-list ref]; linux-arm-msm@vger.kernel.org; linux- soc@vger.kernel.org; lakml [off-list ref]; Rajendra Nayak [off-list ref]; nicolas.dechesne@linaro.org; celster@codeaurora.org; tfinkel@codeaurora.org Subject: Re: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver On 16-05-18, 16:12, Amit Kucheria wrote:quoted
quoted
+ ret = PTR_ERR_OR_ZERO(opp_temp = +dev_pm_opp_set_supported_hw(cpu_dev,&versions,1));quoted
quoted
+ if (0 > ret)Any particular reason to prefer this over (ret < 0) that is generally used? I've seen it used to avoid the == vs. = typos, but not for other comparisons. Suggest sticking to what is commonly used i.e. ret < 0.quoted
+ goto free_opp; + + cpu_dev = get_cpu_device(GOLD_LEAD);Error check cpu_dev here?quoted
+ ret = PTR_ERR_OR_ZERO(opp_temp = +dev_pm_opp_set_supported_hw(cpu_dev,&versions,1));quoted
quoted
+ if (0 > ret) + goto free_opp;The goto here is wrongIf we are here, then the first dev_pm_opp_set_supported_hw() succeeded. And should be deallocated before exit with error.
My bad. Got you.
quoted
quoted
quoted
+ + + ret =PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt",quoted
quoted
+ -1, + NULL, 0)); + + if (0 == ret) + return 0; + +free_opp: + dev_pm_opp_put_supported_hw(opp_temp);This is not needed because dev_pm_opp_set_supported_hw will free memory in case of failure. This call in only needed in case of a successful get.But this is still required for the case where platform device
registration fails.
quoted
-- viresh