]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function
authorEnrico Zanda <e.zanda1@gmail.com>
Sun, 11 May 2025 20:39:21 +0000 (22:39 +0200)
committerAndi Shyti <andi@smida.it>
Fri, 23 May 2025 08:02:27 +0000 (10:02 +0200)
This simplifies the code while improving log.

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

index a0880f4a056d2b8abbac9f58416215a7fc9b130e..b29dec66b2c33ed068725cc64b02b050c163f51a 100644 (file)
@@ -457,10 +457,9 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
                cl->tx_block = true;
                cl->rx_callback = slimpro_i2c_rx_cb;
                ctx->mbox_chan = mbox_request_channel(cl, MAILBOX_I2C_INDEX);
-               if (IS_ERR(ctx->mbox_chan)) {
-                       dev_err(&pdev->dev, "i2c mailbox channel request failed\n");
-                       return PTR_ERR(ctx->mbox_chan);
-               }
+               if (IS_ERR(ctx->mbox_chan))
+                       return dev_err_probe(&pdev->dev, PTR_ERR(ctx->mbox_chan),
+                                            "i2c mailbox channel request failed\n");
        } else {
                struct pcc_mbox_chan *pcc_chan;
                const struct acpi_device_id *acpi_id;
@@ -477,17 +476,16 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
                cl->tx_block = false;
                cl->rx_callback = slimpro_i2c_pcc_rx_cb;
                pcc_chan = pcc_mbox_request_channel(cl, ctx->mbox_idx);
-               if (IS_ERR(pcc_chan)) {
-                       dev_err(&pdev->dev, "PCC mailbox channel request failed\n");
-                       return PTR_ERR(pcc_chan);
-               }
+               if (IS_ERR(pcc_chan))
+                       return dev_err_probe(&pdev->dev, PTR_ERR(pcc_chan),
+                                            "PCC mailbox channel request failed\n");
 
                ctx->pcc_chan = pcc_chan;
                ctx->mbox_chan = pcc_chan->mchan;
 
                if (!ctx->mbox_chan->mbox->txdone_irq) {
-                       dev_err(&pdev->dev, "PCC IRQ not supported\n");
-                       rc = -ENOENT;
+                       rc = dev_err_probe(&pdev->dev, -ENOENT,
+                                          "PCC IRQ not supported\n");
                        goto mbox_err;
                }