Thread (11 messages) 11 messages, 2 authors, 2025-05-10

Re: [PATCH v2 4/4] net: airoha: Use dev_err_probe()

From: Christophe JAILLET <hidden>
Date: 2025-05-08 16:01:28
Also in: kernel-janitors, linux-arm-kernel, linux-mediatek, lkml

Le 08/05/2025 à 17:43, Lorenzo Bianconi a écrit :
On May 08, Christophe JAILLET wrote:
quoted
Use dev_err_probe() to slightly simplify the code.
It is less verbose, more informational and makes error logging more
consistent in the probe.

Signed-off-by: Christophe JAILLET <redacted>
---
Changes in v2:
   - New patch

Compile tested only.
---
  drivers/net/ethernet/airoha/airoha_eth.c | 21 +++++++++------------
  1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index 2335aa59b06f..7404ee894467 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -2896,10 +2896,9 @@ static int airoha_probe(struct platform_device *pdev)
  	eth->dev = &pdev->dev;
  
  	err = dma_set_mask_and_coherent(eth->dev, DMA_BIT_MASK(32));
-	if (err) {
-		dev_err(eth->dev, "failed configuring DMA mask\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(eth->dev, err,
+				     "failed configuring DMA mask\n");
Can dma_set_mask_and_coherent() return -EPROBE_DEFER? The other parts are fine.

Regards,
Lorenzo
No, it can't, but using dev_err_probe() does not hurt.

Using dev_err_probe():
   - saves 1 LoC
   - is consistent in the function
   - log the error code in a human readable format
   - generate smaller binaries (can easily be checked with size)

So, even if "unneeded", I think it is still a improvement.

CJ
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help