lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] leds: ktd2692: Make aux-gpios optional
On Thu, Apr 7, 2022 at 1:33 PM Markuss Broks <markuss.broks@gmail.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

\
 
 \ /
  Last update: 2022-04-08 13:09    [W:0.069 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site