]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: sprd: Replace dev_err() with dev_err_probe() in probe function
authorEnrico Zanda <e.zanda1@gmail.com>
Tue, 20 May 2025 19:43:58 +0000 (21:43 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 28 May 2026 22:05:03 +0000 (00:05 +0200)
This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250520194400.341079-9-e.zanda1@gmail.com
drivers/i2c/busses/i2c-sprd.c

index 1b490525d8dd12e72a814e52371f74a552297a61..7b321a956fca8d9e794bfbc69951c7fe0d1fda25 100644 (file)
@@ -469,11 +469,10 @@ static int sprd_i2c_clk_init(struct sprd_i2c *i2c_dev)
                i2c_dev->adap.nr, i2c_dev->src_clk);
 
        i2c_dev->clk = devm_clk_get(i2c_dev->dev, "enable");
-       if (IS_ERR(i2c_dev->clk)) {
-               dev_err(i2c_dev->dev, "i2c%d can't get the enable clock\n",
-                       i2c_dev->adap.nr);
-               return PTR_ERR(i2c_dev->clk);
-       }
+       if (IS_ERR(i2c_dev->clk))
+               return dev_err_probe(i2c_dev->dev, PTR_ERR(i2c_dev->clk),
+                                    "i2c%d can't get the enable clock\n",
+                                    i2c_dev->adap.nr);
 
        return 0;
 }
@@ -548,13 +547,13 @@ static int sprd_i2c_probe(struct platform_device *pdev)
                IRQF_NO_SUSPEND | IRQF_ONESHOT,
                pdev->name, i2c_dev);
        if (ret) {
-               dev_err(&pdev->dev, "failed to request irq %d\n", i2c_dev->irq);
+               dev_err_probe(&pdev->dev, ret, "failed to request irq %d\n", i2c_dev->irq);
                goto err_rpm_put;
        }
 
        ret = i2c_add_numbered_adapter(&i2c_dev->adap);
        if (ret) {
-               dev_err(&pdev->dev, "add adapter failed\n");
+               dev_err_probe(&pdev->dev, ret, "add adapter failed\n");
                goto err_rpm_put;
        }