Skip to content

Commit 549a1be

Browse files
krzkvireshk
authored andcommitted
OPP: of: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 8f0b4cc commit 549a1be

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/opp/of.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,6 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
956956
/* Initializes OPP tables based on new bindings */
957957
static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
958958
{
959-
struct device_node *np;
960959
int ret, count = 0;
961960
struct dev_pm_opp *opp;
962961

@@ -971,13 +970,12 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
971970
}
972971

973972
/* We have opp-table node now, iterate over it and add OPPs */
974-
for_each_available_child_of_node(opp_table->np, np) {
973+
for_each_available_child_of_node_scoped(opp_table->np, np) {
975974
opp = _opp_add_static_v2(opp_table, dev, np);
976975
if (IS_ERR(opp)) {
977976
ret = PTR_ERR(opp);
978977
dev_err(dev, "%s: Failed to add OPP, %d\n", __func__,
979978
ret);
980-
of_node_put(np);
981979
goto remove_static_opp;
982980
} else if (opp) {
983981
count++;

0 commit comments

Comments
 (0)