Re: [PATCH v8 1/3] leds: ktd2692: Avoid duplicate error messages on probe deferral

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

 



On Thu, May 5, 2022 at 5:25 PM Markuss Broks <markuss.broks@xxxxxxxxx> wrote:
>
> Use dev_err_probe instead of dev_err to avoid duplicate error
> messages if the GPIO allocation makes the probe defer.

Thanks!

There are two improvements we can make here.
1) adding a Fixes tag, so it can be backported to stable kernels;
2) see below.

...

>         led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS);
>         ret = PTR_ERR_OR_ZERO(led->ctrl_gpio);
> -       if (ret) {
> -               dev_err(dev, "cannot get ctrl-gpios %d\n", ret);
> -               return ret;
> -       }
> +       if (ret)
> +               return dev_err_probe(dev, ret, "cannot get ctrl-gpios\n");

You may improve this and simultaneously prepare for the next change to
be smaller

       led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS);
       if (IS_ERR(led->ctrl_gpio))
               return dev_err_probe(dev, PTR_ERR(led->ctrl_gpio),
"cannot get ctrl-gpios\n");

All the same for the other case.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux