From: Hans Zhang <18255117159@163.com> Date: Tue, 7 Apr 2026 01:40:33 +0000 (+0800) Subject: mmc: core: Simplify with scoped for each OF child loop X-Git-Tag: v7.1-rc1~157^2~2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=873cc5560804f5270b1670f8bed4d55400343cf5;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index 6f727b4a60a52..940549d3b95d5 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; }