Re: [PATCH] media: i2c: max9286: Use dev_err_probe() helper

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

 



Hi Niklas,

On Wed, Dec 8, 2021 at 1:18 PM Niklas Söderlund
<niklas.soderlund+renesas@xxxxxxxxxxxx> wrote:
> Use the dev_err_probe() helper, instead of open-coding the same
> operation. While at it retrieve the error once and use it from
> 'ret' instead of retrieving it twice.
>
> Suggested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

I guess that's too much credit for me ;-)

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> --- a/drivers/media/i2c/max9286.c
> +++ b/drivers/media/i2c/max9286.c
> @@ -1295,11 +1295,9 @@ static int max9286_probe(struct i2c_client *client)
>
>         priv->regulator = devm_regulator_get(&client->dev, "poc");
>         if (IS_ERR(priv->regulator)) {
> -               if (PTR_ERR(priv->regulator) != -EPROBE_DEFER)
> -                       dev_err(&client->dev,
> -                               "Unable to get PoC regulator (%ld)\n",
> -                               PTR_ERR(priv->regulator));
>                 ret = PTR_ERR(priv->regulator);
> +               dev_err_probe(&client->dev, ret,
> +                             "Unable to get PoC regulator\n");

You can even combine these two, as dev_err_probe() was designed
to streamline error handling, and thus returns the error again:

    ret = dev_err_probe(&client->dev, PTR_ERR(priv->regulator),
                        "Unable to get PoC regulator\n");

>                 goto err_powerdown;
>         }

Regardless:
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux