]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: i2c: max9286: Use dev_err_probe() helper
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 8 Dec 2021 12:17:56 +0000 (13:17 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:24:12 +0000 (09:24 +0200)
BugLink: https://bugs.launchpad.net/bugs/1981864
[ 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 <geert+renesas@glider.be>
Signed-off-by: Niklas S\xF6derlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/i2c/max9286.c

index 1aa2c58fd38c5d2be38d0055899d4c968a149afc..1bbcc46fffd558b54aff154350e92ebb89f81aab 100644 (file)
@@ -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;
        }