* [PATCH] mmc: core: quirks: Add of_node_put() when breaking out of loop
@ 2022-07-19 9:10 Liang He
2022-07-21 16:13 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-07-19 9:10 UTC (permalink / raw)
To: ulf.hansson, linux-mmc, windhl
In mmc_fixup_of_compatible_match(), we should call of_node_put()
when breaking out of for_each_child_of_node() which will increase
and decrease the refcount during one iteration.
Fixes: b360b1102670 ("mmc: core: allow to match the device tree to apply quirks")
Signed-off-by: Liang He <windhl@126.com>
---
drivers/mmc/core/quirks.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index f879dc63d936..be4393988086 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -163,8 +163,10 @@ static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card,
struct device_node *np;
for_each_child_of_node(mmc_dev(card->host)->of_node, np) {
- if (of_device_is_compatible(np, compatible))
+ if (of_device_is_compatible(np, compatible)) {
+ of_node_put(np);
return true;
+ }
}
return false;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: core: quirks: Add of_node_put() when breaking out of loop
2022-07-19 9:10 [PATCH] mmc: core: quirks: Add of_node_put() when breaking out of loop Liang He
@ 2022-07-21 16:13 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2022-07-21 16:13 UTC (permalink / raw)
To: Liang He; +Cc: linux-mmc
On Tue, 19 Jul 2022 at 11:10, Liang He <windhl@126.com> wrote:
>
> In mmc_fixup_of_compatible_match(), we should call of_node_put()
> when breaking out of for_each_child_of_node() which will increase
> and decrease the refcount during one iteration.
>
> Fixes: b360b1102670 ("mmc: core: allow to match the device tree to apply quirks")
> Signed-off-by: Liang He <windhl@126.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/core/quirks.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
> index f879dc63d936..be4393988086 100644
> --- a/drivers/mmc/core/quirks.h
> +++ b/drivers/mmc/core/quirks.h
> @@ -163,8 +163,10 @@ static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card,
> struct device_node *np;
>
> for_each_child_of_node(mmc_dev(card->host)->of_node, np) {
> - if (of_device_is_compatible(np, compatible))
> + if (of_device_is_compatible(np, compatible)) {
> + of_node_put(np);
> return true;
> + }
> }
>
> return false;
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-21 16:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 9:10 [PATCH] mmc: core: quirks: Add of_node_put() when breaking out of loop Liang He
2022-07-21 16:13 ` Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.