@@ -585,23 +585,18 @@ 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;
struct scmi_perf_info *pi = ph->get_priv(ph);
dom = pi->dom_info + domain;
- for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) {
- freq = opp->perf * dom->mult_factor;
+ for (idx = 0; idx < dom->opp_count; idx++) {
+ freq = dom->opp[idx].perf * dom->mult_factor;
ret = dev_pm_opp_add(dev, freq, 0);
if (ret) {
dev_warn(dev, "failed to add opp %luHz\n", freq);
-
- while (idx-- > 0) {
- freq = (--opp)->perf * dom->mult_factor;
- dev_pm_opp_remove(dev, freq);
- }
+ dev_pm_opp_remove_all_dynamic(dev);
return ret;
}
}
Let's simplify the code in scmi_dvfs_device_opps_add() by using dev_pm_opp_remove_all_dynamic() in its error path. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/firmware/arm_scmi/perf.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)