Re: [PATCH leds v2 08/11] leds: turris-omnia: Use dev_err_probe() where appropriate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 3, 2024 at 1:20 PM Marek Behún <kabel@xxxxxxxxxx> wrote:
>
> Use dev_err_probe() instead of dev_err() + separate return where
> appropriate.

...

> +       if (ret)
> +               return dev_err_probe(dev, ret, "Cannot set LED %pOF to software mode\n", np);

Side note: Not sure how np is being used besides the messaging. If
it's only for the messaging, I would rather see %pfw and fwnode based
approach.

...

>         count = of_get_available_child_count(np);
> -       if (!count) {
> -               dev_err(dev, "LEDs are not defined in device tree!\n");
> -               return -ENODEV;
> -       } else if (count > OMNIA_BOARD_LEDS) {
> -               dev_err(dev, "Too many LEDs defined in device tree!\n");
> -               return -EINVAL;
> -       }
> +       if (!count)

Dunno if 'if (count == 0)' would look better from the readability perspective.

> +               return dev_err_probe(dev, -ENODEV, "LEDs are not defined in device tree!\n");
> +       else if (count > OMNIA_BOARD_LEDS)

Even in the original code the 'else' is redundant.

> +               return dev_err_probe(dev, -EINVAL, "Too many LEDs defined in device tree!\n");

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux