From: Niklas Söderlund Date: Wed, 8 Dec 2021 12:17:56 +0000 (+0100) Subject: media: i2c: max9286: Use dev_err_probe() helper X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d7678a7a55d063a67b5b3432f9ca97c7785bc255;p=linux.git media: i2c: max9286: Use dev_err_probe() helper [ Upstream commit df78b858e773967112b4444400fb7bb5bd7a9d8a ] 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. Link: https://lore.kernel.org/linux-media/20211208121756.3051565-1-niklas.soderlund+renesas@ragnatech.se Suggested-by: Geert Uytterhoeven Signed-off-by: Niklas S\xF6derlund Reviewed-by: Geert Uytterhoeven Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 1aa2c58fd38c5..1bbcc46fffd55 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -1296,11 +1296,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; }