mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
firmware: arm_scmi: Simplify error path in scmi_dvfs_device_opps_add()
Let's simplify the code in scmi_dvfs_device_opps_add() by using dev_pm_opp_remove_all_dynamic() in the error path. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20230925131715.138411-8-ulf.hansson@linaro.org Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
parent
0a30c0e9ca
commit
033ca4de12
1 changed files with 4 additions and 12 deletions
|
@ -787,30 +787,22 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph,
|
|||
{
|
||||
int idx, ret;
|
||||
unsigned long freq;
|
||||
struct scmi_opp *opp;
|
||||
struct perf_dom_info *dom;
|
||||
|
||||
dom = scmi_perf_domain_lookup(ph, domain);
|
||||
if (IS_ERR(dom))
|
||||
return PTR_ERR(dom);
|
||||
|
||||
for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) {
|
||||
for (idx = 0; idx < dom->opp_count; idx++) {
|
||||
if (!dom->level_indexing_mode)
|
||||
freq = opp->perf * dom->mult_factor;
|
||||
freq = dom->opp[idx].perf * dom->mult_factor;
|
||||
else
|
||||
freq = opp->indicative_freq * 1000;
|
||||
freq = dom->opp[idx].indicative_freq * 1000;
|
||||
|
||||
ret = dev_pm_opp_add(dev, freq, 0);
|
||||
if (ret) {
|
||||
dev_warn(dev, "failed to add opp %luHz\n", freq);
|
||||
|
||||
while (idx-- > 0) {
|
||||
if (!dom->level_indexing_mode)
|
||||
freq = (--opp)->perf * dom->mult_factor;
|
||||
else
|
||||
freq = (--opp)->indicative_freq * 1000;
|
||||
dev_pm_opp_remove(dev, freq);
|
||||
}
|
||||
dev_pm_opp_remove_all_dynamic(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue