lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <9c22f5b3-d2af-2645-c1d0-5e8bbdaf5031@linaro.org>
Date:   Fri, 10 Mar 2023 11:48:53 +0100
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Bogdan Ionescu <bogdan.ionescu.work@...il.com>
Cc:     Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        linux-leds@...r.kernel.or, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ