On Wed, Dec 08, 2021 at 01:29:57PM +0100, Geert Uytterhoeven wrote: > On Wed, Dec 8, 2021 at 1:18 PM Niklas Söderlund 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"); With or witout that, Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > > goto err_powerdown; > > } > > Regardless: > Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> -- Regards, Laurent Pinchart