Skip to content

Commit cd18e9a

Browse files
krzklag-linaro
authored andcommitted
mfd: core: 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> Link: https://patch.msgid.link/20251224124456.208529-3-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 541b1e8 commit cd18e9a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/mfd/mfd-core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ static int mfd_add_device(struct device *parent, int id,
146146
{
147147
struct resource *res;
148148
struct platform_device *pdev;
149-
struct device_node *np = NULL;
150149
struct mfd_of_node_entry *of_entry, *tmp;
151150
bool disabled = false;
152151
int ret = -ENOMEM;
@@ -184,7 +183,7 @@ static int mfd_add_device(struct device *parent, int id,
184183
goto fail_res;
185184

186185
if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
187-
for_each_child_of_node(parent->of_node, np) {
186+
for_each_child_of_node_scoped(parent->of_node, np) {
188187
if (of_device_is_compatible(np, cell->of_compatible)) {
189188
/* Skip 'disabled' devices */
190189
if (!of_device_is_available(np)) {
@@ -195,7 +194,6 @@ static int mfd_add_device(struct device *parent, int id,
195194
ret = mfd_match_of_node_to_dev(pdev, np, cell);
196195
if (ret == -EAGAIN)
197196
continue;
198-
of_node_put(np);
199197
if (ret)
200198
goto fail_alias;
201199

0 commit comments

Comments
 (0)