From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Bogdan Ionescu <bogdan.ionescu.work@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-leds@vger.kernel.or, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver
Date: Fri, 10 Mar 2023 11:48:53 +0100 [thread overview]
Message-ID: <9c22f5b3-d2af-2645-c1d0-5e8bbdaf5031@linaro.org> (raw)
In-Reply-To: <CALfPHoVFVpnLVEjzccbyMvmNR_=3vjJ+Ub8tkriJOvvV0cLzsA@mail.gmail.com>
On 10/03/2023 11:44, Bogdan Ionescu wrote:
>>> + /* Check required properties */
>>> + if (!fwnode_property_present(child, "rohm,enable-outputs")) {
>>> + dev_err(dev, "No rohm,enable-outputs property found");
>>> + return -ENOENT;
>>> + }
>>> +
>>> + ret = fwnode_property_read_u32(child, "rohm,enable-outputs",
> &led->enable);
>>> + if (ret || (led->enable & LEDSEL_MASK) != led->enable) {
>>> + dev_err(dev, "Failed to read rohm,enable-outputs property");
>>
>> No need to check for properties twice...
>
> I understand that you can just check the return value, but what is then
> the point of the fwnode_property_present() function? Where is it otherwise
> supposed to be used?
>
> I am happy to remove the first check, but I would like to understand the
> reasoning behind it. I found value in separating a value not found error
> from an incorrect value error.
ENOENT is not valid code - No such file or directory. Thus you cannot
return different codes. The code should be simple and printing error on
fwnode_property_read_u32() is enough to report it to the developer.
Best regards,
Krzysztof
next prev parent reply other threads:[~2023-03-10 10:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 20:14 [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Bogdan Ionescu
2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu
2023-03-09 9:06 ` Krzysztof Kozlowski
[not found] ` <CALfPHoVFVpnLVEjzccbyMvmNR_=3vjJ+Ub8tkriJOvvV0cLzsA@mail.gmail.com>
2023-03-10 10:48 ` Krzysztof Kozlowski [this message]
2023-03-18 4:54 ` kernel test robot
2023-03-08 23:16 ` [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Rob Herring
2023-03-09 9:03 ` Krzysztof Kozlowski
[not found] ` <CALfPHoVT007ifyTepr_p-saDQtv5Sk7iYXM4qSMXyaCLL3iE2A@mail.gmail.com>
2023-03-11 9:06 ` Krzysztof Kozlowski
[not found] ` <CALfPHoVR=kmHmbhNzQg-bW-bV6P8e_sE+vEebQXOfL-nEWg5TQ@mail.gmail.com>
2023-03-12 20:42 ` Krzysztof Kozlowski
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=9c22f5b3-d2af-2645-c1d0-5e8bbdaf5031@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=bogdan.ionescu.work@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.or \
--cc=pavel@ucw.cz \
--cc=robh+dt@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
all inboxes | Powered by JetHome®