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

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

 



Quoting Niklas Söderlund (2021-12-08 12:17:56)
> 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>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

Looks better already...

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>

> ---
>  drivers/media/i2c/max9286.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> index 7c663fd587bbeefa..16aa7e5b0e81c210 100644
> --- 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");
>                 goto err_powerdown;
>         }
>  
> -- 
> 2.34.1
>




[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