linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Enrico Zanda <e.zanda1@gmail.com>
To: linux-i2c@vger.kernel.org
Cc: andi.shyti@kernel.org, Enrico Zanda <e.zanda1@gmail.com>
Subject: [PATCH 08/10] i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function
Date: Tue, 15 Apr 2025 20:34:45 +0200	[thread overview]
Message-ID: <20250415183447.396277-9-e.zanda1@gmail.com> (raw)
In-Reply-To: <20250415183447.396277-1-e.zanda1@gmail.com>

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-xgene-slimpro.c | 27 ++++++++++++--------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 663fe5604dd6..82cad0e9c384 100644
--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -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;
@@ -480,17 +479,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;
 		}
 
@@ -511,15 +509,14 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
 							pcc_chan->shmem_size,
 							MEMREMAP_WB);
 		} else {
-			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
-			rc = -ENOENT;
+			rc = dev_err_probe(&pdev->dev, -ENOENT,
+					   "Failed to get PCC comm region\n");
 			goto mbox_err;
 		}
 
 		if (!ctx->pcc_comm_addr) {
-			dev_err(&pdev->dev,
-				"Failed to ioremap PCC comm region\n");
-			rc = -ENOMEM;
+			rc = dev_err_probe(&pdev->dev, -ENOMEM,
+				      "Failed to ioremap PCC comm region\n");
 			goto mbox_err;
 		}
 	}
-- 
2.43.0


  parent reply	other threads:[~2025-04-15 18:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
2025-04-15 18:34 ` [PATCH 01/10] i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe function Enrico Zanda
2025-04-15 18:34 ` [PATCH 02/10] i2c: uniphier: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 03/10] i2c: via: " Enrico Zanda
2025-04-16 20:44   ` Andi Shyti
2025-04-15 18:34 ` [PATCH 04/10] i2c: viai2c-wmt: " Enrico Zanda
2025-04-16 20:42   ` Andi Shyti
2025-05-13 21:00     ` Enrico Zanda
2025-04-15 18:34 ` [PATCH 05/10] i2c: viapro: " Enrico Zanda
2025-04-16 21:12   ` Andi Shyti
2025-04-15 18:34 ` [PATCH 06/10] i2c: viperboard: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 07/10] i2c: virtio: " Enrico Zanda
2025-04-15 18:34 ` Enrico Zanda [this message]
2025-04-16 21:19   ` [PATCH 08/10] i2c: xgene-slimpro: " Andi Shyti
2025-05-11 19:55     ` Enrico Zanda
2025-04-15 18:34 ` [PATCH 09/10] i2c: i2c-xiic: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 10/10] i2c: scx200_acb: " Enrico Zanda
2025-04-16 21:49 ` [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Andi Shyti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250415183447.396277-9-e.zanda1@gmail.com \
    --to=e.zanda1@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).