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> --- 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