diff mbox series

[08/10] i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function

Message ID 20250415183447.396277-9-e.zanda1@gmail.com
State New
Headers show
Series i2c: Replace dev_err() with dev_err_probe() | expand

Commit Message

Enrico Zanda April 15, 2025, 6:34 p.m. UTC
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(-)

Comments

Andi Shyti April 16, 2025, 9:19 p.m. UTC | #1
Hi Enrico,

...

> @@ -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");

these lines were removed by 1dde04276b4d ("i2c: xgene-slimpro:
Simplify PCC shared memory region handling").

Can you please rebase your work on top of my branch:

https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

branch i2c/i2c-host.

Thanks,
Andi

>  			goto mbox_err;
>  		}
>  	}
> -- 
> 2.43.0
>
diff mbox series

Patch

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;
 		}
 	}