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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VeMWLXCz_xf=Px-jRw2Fez1Kma2V80cqmu-Ta-67TWaRA@mail.gmail.com>
Date:   Fri, 8 Apr 2022 14:04:23 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Markuss Broks <markuss.broks@...il.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        phone-devel@...r.kernel.org,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
        <devicetree@...r.kernel.org>, Hans de Goede <hdegoede@...hat.com>, Andy
        Shevchenko <andy.shevchenko@...il.com>," 
        <~postmarketos/upstreaming@...ts.sr.ht>,
        Pavel Machek <pavel@....cz>, Rob Herring <robh+dt@...nel.org>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Linus Walleij <linus.walleij@...aro.org>,
        Linux LED Subsystem <linux-leds@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH 2/2] leds: ktd2692: Make aux-gpios optional

On Thu, Apr 7, 2022 at 1:33 PM Markuss Broks <markuss.broks@...il.com> wrote:
>
> Make the AUX pin optional, since it isn't a core part of functionality,
> and the device is designed to be operational with only one CTRL pin.
>
> Also pick up maintainership for the LED driver and the yaml bindings.

maintenance?

...

> -               gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
> +               if (led->aux_gpio)
> +                       gpiod_direction_output(led->aux_gpio, KTD2692_LOW);

Redundant change.

...

> -               gpiod_direction_output(led->aux_gpio, KTD2692_HIGH);
> +               if (led->aux_gpio)
> +                       gpiod_direction_output(led->aux_gpio, KTD2692_HIGH);

Ditto.

...

> -               gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
> +               if (led->aux_gpio)
> +                       gpiod_direction_output(led->aux_gpio, KTD2692_LOW);

Ditto.

...

> -       gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
> +       if (led->aux_gpio)
> +               gpiod_direction_output(led->aux_gpio, KTD2692_LOW);

Ditto.

...

>         ret = PTR_ERR_OR_ZERO(led->aux_gpio);
> -       if (ret) {
> -               dev_err(dev, "cannot get aux-gpios %d\n", ret);
> -               return ret;
> -       }
> +       if (ret)
> +               dev_info(dev, "aux-gpios not available, flash mode current might be reduced\n");

dev_warn()?

After this change the use of PTR_ERR_OR_ZERO() becomes unjustified, what about
        if (IS_ERR(led->aux_gpio))
?

But the problem here is the ignorance of important error codes, such a
deferred probe.

What you need is to switch to devm_gpiod_get_optional().

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ