Re: [PATCH 20/32] riscv: Add Kendryte K210 FPIOA pinctrl driver

Serge Semin
2020-11-30T07:06:58Z

Damien,
Just a tiny nitpick below.

On Mon, Nov 30, 2020 at 03:13:45AM +0000, Damien Le Moal wrote:
> [...]
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 2a9046c0fb16..4a801e83919b 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -617,8 +617,10 @@ static int dwapb_get_reset(struct dwapb_gpio *gpio)
>
> gpio->rst = devm_reset_control_get_optional_shared(gpio->dev, NULL);

> if (IS_ERR(gpio->rst)) {
> - dev_err(gpio->dev, "Cannot get reset descriptor\n");
> - return PTR_ERR(gpio->rst);
> + err = PTR_ERR(gpio->rst);
> + if (err != -EPROBE_DEFER)
> + dev_err(gpio->dev, "Cannot get reset descriptor\n");
> + return err;
> }

There is a dedicated method to generically handle the PROBE_DEFER
error returned by functions like get(resource): dev_err_probe().
So here you'd just need to do:

- if (IS_ERR(gpio->rst)) {
- dev_err(gpio->dev, "Cannot get reset descriptor\n");
- return PTR_ERR(gpio->rst);
- }
+ if (IS_ERR(gpio->rst))
+ return dev_err_probe(gpio->dev, PTR_ERR(gpio->rst),
+ "Cannot get reset descriptor\n");

-Sergey

>
> and all drivers can now use builtin_platform_driver() declaration with a clean
> boot log. If you are OK with the above patch, I will send it.
>
> Thanks !
>
> >
> > Yours,
> > Linus Walleij
>
> --
> Damien Le Moal
> Western Digital