summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>2025-12-24 13:44:57 +0100
committerLee Jones <lee@kernel.org>2026-01-22 14:23:05 +0000
commitcd18e9af79ad17db88c0799197ed1fd948396388 (patch)
treebaba558ebd323fa81a2fbdd1b0b02d2ccaa1fa8a /drivers/mfd
parent541b1e867ea1c3c9021ce684113859e0494094ea (diff)
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/mfd-core.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index a30f93bf030a..68de2f741142 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -146,7 +146,6 @@ static int mfd_add_device(struct device *parent, int id,
{
struct resource *res;
struct platform_device *pdev;
- struct device_node *np = NULL;
struct mfd_of_node_entry *of_entry, *tmp;
bool disabled = false;
int ret = -ENOMEM;
@@ -184,7 +183,7 @@ static int mfd_add_device(struct device *parent, int id,
goto fail_res;
if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
- for_each_child_of_node(parent->of_node, np) {
+ for_each_child_of_node_scoped(parent->of_node, np) {
if (of_device_is_compatible(np, cell->of_compatible)) {
/* Skip 'disabled' devices */
if (!of_device_is_available(np)) {
@@ -195,7 +194,6 @@ static int mfd_add_device(struct device *parent, int id,
ret = mfd_match_of_node_to_dev(pdev, np, cell);
if (ret == -EAGAIN)
continue;
- of_node_put(np);
if (ret)
goto fail_alias;