mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rob Herring (Arm)" <robh@kernel.org>
To: "Miquel Raynal (Schneider Electric)" <miquel.raynal@bootlin.com>
Cc: Pascal EBERHARD <pascal.eberhard@se.com>,
	Saravana Kannan <saravanak@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sashiko <sashiko-bot@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] of: base: Handle optional argument in of_parse_phandle_with_args_map()
Date: Wed, 22 Jul 2026 08:48:20 -0500	[thread overview]
Message-ID: <178472809900.492485.3835250826852589304.robh@kernel.org> (raw)
In-Reply-To: <20260716-schneider-v7-2-rc1-eip-of-fix-v1-1-9b9383f936c6@bootlin.com>


On Thu, 16 Jul 2026 12:51:12 +0200, Miquel Raynal (Schneider Electric) wrote:
> The kernel doc claims out_args is optional. In practice, the function
> unconditionally dereferences it. It feels like calling this function
> with a NULL out_args argument may be a valid use case (in order to know
> if the lookup would work, even though we might not care about the
> result), even though in practice there seem to be no actual user of that
> possibility. All callers give an on-stack object to fill.
> 
> There are two ways out: either we drop the "optional" wording from the
> kernel doc, or we handle the NULL case properly. Since handling this
> case goes in favor of more harmonization of the semantics and since
> of_parse_phandle_with_args() actually do handle that situation
> correctly, let's handle it in the _map() case as well.
> 
> Use a local on-stack object in case no argument is passed. This way, we
> actually go through the same logic as if there was an argument. We may
> however return rather early, since the second part of the function is
> dedicated at filling that argument.
> 
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/all/20260710183359.61D3A1F000E9@smtp.kernel.org/
> Signed-off-by: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>
> ---
> The number of passing unit tests is identical before/after the commit:
> [   10.774120] ### dt-test ### end of unittest - 426 passed, 1 failed
> ---
>  drivers/of/base.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 

Applied, thanks!


      reply	other threads:[~2026-07-22 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 10:51 Miquel Raynal (Schneider Electric)
2026-07-22 13:48 ` Rob Herring (Arm) [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=178472809900.492485.3835250826852589304.robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pascal.eberhard@se.com \
    --cc=saravanak@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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

all inboxes | Powered by JetHome®