diff options
| author | Hans Zhang <18255117159@163.com> | 2026-04-07 09:40:33 +0800 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@linaro.org> | 2026-04-09 17:51:21 +0200 |
| commit | 873cc5560804f5270b1670f8bed4d55400343cf5 (patch) | |
| tree | 14443ed41a7a680a5441d23c34228b32949863e9 /drivers/mmc | |
| parent | 5fa0e32ed4f4a8a62998d0c955311cbfe92919af (diff) | |
| download | lwn-873cc5560804f5270b1670f8bed4d55400343cf5.tar.gz lwn-873cc5560804f5270b1670f8bed4d55400343cf5.zip | |
mmc: core: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to simplify the
code, but also to ensure the device node reference is automatically
released when the loop scope ends.
Signed-off-by: Hans Zhang <18255117159@163.com>
Reviewed-by: Shawn Lin <shawn.lin@linux.dev>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
| -rw-r--r-- | drivers/mmc/core/quirks.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index 6f727b4a60a5..940549d3b95d 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -225,14 +225,9 @@ static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = { static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card, const char *compatible) { - struct device_node *np; - - for_each_child_of_node(mmc_dev(card->host)->of_node, np) { - if (of_device_is_compatible(np, compatible)) { - of_node_put(np); + for_each_child_of_node_scoped(mmc_dev(card->host)->of_node, np) + if (of_device_is_compatible(np, compatible)) return true; - } - } return false; } |
