mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Alban Bedel <alban.bedel@lht.dlh.de>
Cc: devicetree@vger.kernel.org, Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>,
	driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
	Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Subject: Re: [PATCH] of: property: Fix of_fwnode_get_reference_args() with negative index
Date: Tue, 16 Jun 2026 06:01:51 +0200	[thread overview]
Message-ID: <00d51781-0172-4334-986c-0701ae4c58d8@kernel.org> (raw)
In-Reply-To: <20260615134747.3cdb9599@OMT-CWNXR4TFW5-LHT>

On 15/06/2026 13:47, Alban Bedel wrote:
> On Mon, 15 Jun 2026 11:54:01 +0200
> Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>> Indices larger than INT_MAX are valid in the fwnode API, so returning
>>> -EINVAL is not appropriate here.
>>>   
>>
>> Then neither ENOENT are.
>>
>> But really, EINVAL is correct here. This is OF implementation, so this
>> implementation decides what is EINVAL and what is right. Not fwnode API.
> 
> I think there is a missunderstanding here. The function we are talking
> about, of_fwnode_get_reference_args(), is the OF backed implementation
> of fwnode_property_get_reference_args(). As such it must follow the API
> documented by fwnode_property_get_reference_args() which list the
> following return values:
> 
>  * Return: %0 on success
>  *	    %-ENOENT when the index is out of bounds, the index has an empty
>  *		     reference or the property was not found
>  *	    %-EINVAL on parse error
>  *	    %-ENOTCONN when the remote firmware node exists but has not been
>  *		       registered yet
> 
> It is not explicitly documented what should be returned if the index is
> not representable in the backend, but considering it out of bound seems
> to be the most sensible thing to do.
> 

I agree, I did not consider the docs for
fwnode_property_get_reference_args().

Please send v2 fixing the comment style and with:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>


Best regards,
Krzysztof

      reply	other threads:[~2026-06-16  4:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 10:28 Alban Bedel
2026-06-15  6:33 ` Krzysztof Kozlowski
2026-06-15  9:33   ` Alban Bedel
2026-06-15  9:54     ` Krzysztof Kozlowski
2026-06-15 11:47       ` Alban Bedel
2026-06-16  4:01         ` 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=00d51781-0172-4334-986c-0701ae4c58d8@kernel.org \
    --to=krzk@kernel.org \
    --cc=alban.bedel@lht.dlh.de \
    --cc=devicetree@vger.kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@kernel.org \
    --cc=tommaso.merciai.xr@bp.renesas.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®