From: Krzysztof Kozlowski <krzk@kernel.org>
To: Yuho Choi <dbgh9129@gmail.com>
Cc: robh@kernel.org, saravanak@kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] of: Put coreboot node after compatibility check
Date: Tue, 4 Aug 2026 10:34:51 +0200 [thread overview]
Message-ID: <20260804-tricky-malachite-robin-192339@quoll> (raw)
In-Reply-To: <20260802023821.494178-1-dbgh9129@gmail.com>
On Sat, Aug 01, 2026 at 10:38:21PM -0400, Yuho Choi wrote:
> of_find_compatible_node() returns a referenced device node, but
> EXCLUDED_DEFAULT_CELLS_PLATFORMS used the result only as a boolean and
> discarded the reference. This leaked a reference each time the
> address-cells or size-cells warning condition was evaluated on a
> coreboot system.
>
> Use a helper that drops the node reference after checking whether the
> coreboot node exists.
>
> Fixes: 8600058ba28a7 ("of: Add coreboot firmware to excluded default cells list")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---
> drivers/of/base.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 6e7a42dedad3..8d04eaed9805 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -95,9 +95,21 @@ static bool __of_node_is_type(const struct device_node *np, const char *type)
> return !strcmp(match, type);
> }
>
> +static bool of_coreboot_present(void)
> +{
> + struct device_node *np;
> + bool found;
> +
> + np = of_find_compatible_node(NULL, NULL, "coreboot");
Code is simple, but could be even simpler with __free. Basically two
instructions instead of four and no need for this assignment comparison.
> + found = np != NULL;
> + of_node_put(np);
Best regards,
Krzysztof
prev parent reply other threads:[~2026-08-04 8:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 2:38 [PATCH v1] of: Put coreboot node after compatibility check Yuho Choi
2026-08-02 2:50 ` sashiko-bot
2026-08-04 8:34 ` Krzysztof Kozlowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804-tricky-malachite-robin-192339@quoll \
--to=krzk@kernel.org \
--cc=dbgh9129@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox