netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port()
@ 2025-05-15 19:59 Christophe JAILLET
  2025-05-15 19:59 ` [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Christophe JAILLET @ 2025-05-15 19:59 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-arm-kernel, linux-mediatek, netdev

If register_netdev() fails, the error handling path of the probe will not
free the memory allocated by the previous airoha_metadata_dst_alloc() call
because port->dev->reg_state will not be NETREG_REGISTERED.

So, an explicit airoha_metadata_dst_free() call is needed in this case to
avoid a memory leak.

Fixes: af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Changes in v3:
  - None

Changes in v2:
  - New patch
v2: https://lore.kernel.org/all/5c94b9b3850f7f29ed653e2205325620df28c3ff.1746715755.git.christophe.jaillet@wanadoo.fr/

Compile tested only.
---
 drivers/net/ethernet/airoha/airoha_eth.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index 16c7896f931f..af8c4015938c 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -2873,7 +2873,15 @@ static int airoha_alloc_gdm_port(struct airoha_eth *eth,
 	if (err)
 		return err;
 
-	return register_netdev(dev);
+	err = register_netdev(dev);
+	if (err)
+		goto free_metadata_dst;
+
+	return 0;
+
+free_metadata_dst:
+	airoha_metadata_dst_free(port);
+	return err;
 }
 
 static int airoha_probe(struct platform_device *pdev)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe()
  2025-05-15 19:59 [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
@ 2025-05-15 19:59 ` Christophe JAILLET
  2025-05-16 20:16   ` Simon Horman
  2025-05-17 14:07   ` Lorenzo Bianconi
  2025-05-15 19:59 ` [PATCH v3 3/4] net: airoha: Use for_each_child_of_node_scoped() Christophe JAILLET
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Christophe JAILLET @ 2025-05-15 19:59 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-arm-kernel, linux-mediatek, netdev

If an error occurs after a successful airoha_hw_init() call,
airoha_ppe_deinit() needs to be called as already done in the remove
function.

Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Changes in v3:
  - call airoha_ppe_deinit() and not airoha_ppe_init()   [Lorenzo Bianconi]

Changes in v2:
  - Call airoha_ppe_init() at the right place in the error handling path
    of the probe   [Lorenzo Bianconi]
v2: https://lore.kernel.org/all/3791c95da3fa3c3bd2a942210e821d9301362128.1746715755.git.christophe.jaillet@wanadoo.fr/

v1: https://lore.kernel.org/all/f4a420f3a8b4a6fe72798f9774ec9aff2291522d.1744977434.git.christophe.jaillet@wanadoo.fr/

Compile tested only.
---
 drivers/net/ethernet/airoha/airoha_eth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index af8c4015938c..d435179875df 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -2967,6 +2967,7 @@ static int airoha_probe(struct platform_device *pdev)
 error_napi_stop:
 	for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
 		airoha_qdma_stop_napi(&eth->qdma[i]);
+	airoha_ppe_deinit(eth);
 error_hw_cleanup:
 	for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
 		airoha_hw_cleanup(&eth->qdma[i]);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 3/4] net: airoha: Use for_each_child_of_node_scoped()
  2025-05-15 19:59 [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
  2025-05-15 19:59 ` [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
@ 2025-05-15 19:59 ` Christophe JAILLET
  2025-05-15 19:59 ` [PATCH v3 4/4] net: airoha: Use dev_err_probe() Christophe JAILLET
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Christophe JAILLET @ 2025-05-15 19:59 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-arm-kernel, linux-mediatek, netdev

Use for_each_child_of_node_scoped() to slightly simplify the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Changes in v3:
  - None

Changes in v2:
  - New patch
v2: https://lore.kernel.org/all/88143d6af26b32066c92b5ba81d8e08c55426ebe.1746715755.git.christophe.jaillet@wanadoo.fr/

Compile tested only.
---
 drivers/net/ethernet/airoha/airoha_eth.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index d435179875df..2335aa59b06f 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -2886,7 +2886,6 @@ static int airoha_alloc_gdm_port(struct airoha_eth *eth,
 
 static int airoha_probe(struct platform_device *pdev)
 {
-	struct device_node *np;
 	struct airoha_eth *eth;
 	int i, err;
 
@@ -2948,7 +2947,7 @@ static int airoha_probe(struct platform_device *pdev)
 		airoha_qdma_start_napi(&eth->qdma[i]);
 
 	i = 0;
-	for_each_child_of_node(pdev->dev.of_node, np) {
+	for_each_child_of_node_scoped(pdev->dev.of_node, np) {
 		if (!of_device_is_compatible(np, "airoha,eth-mac"))
 			continue;
 
@@ -2956,10 +2955,8 @@ static int airoha_probe(struct platform_device *pdev)
 			continue;
 
 		err = airoha_alloc_gdm_port(eth, np, i++);
-		if (err) {
-			of_node_put(np);
+		if (err)
 			goto error_napi_stop;
-		}
 	}
 
 	return 0;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 4/4] net: airoha: Use dev_err_probe()
  2025-05-15 19:59 [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
  2025-05-15 19:59 ` [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
  2025-05-15 19:59 ` [PATCH v3 3/4] net: airoha: Use for_each_child_of_node_scoped() Christophe JAILLET
@ 2025-05-15 19:59 ` Christophe JAILLET
  2025-05-16 20:16   ` Simon Horman
  2025-05-17 14:09   ` Lorenzo Bianconi
  2025-05-15 21:16 ` [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Lorenzo Bianconi
  2025-05-16 20:16 ` Simon Horman
  4 siblings, 2 replies; 13+ messages in thread
From: Christophe JAILLET @ 2025-05-15 19:59 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-arm-kernel, linux-mediatek, netdev

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 <christophe.jaillet@wanadoo.fr>
---
Changes in v3:
  - None

Changes in v2:
  - New patch
v2: https://lore.kernel.org/all/1b67aa9ea0245325c3779d32dde46cdf5c232db9.1746715755.git.christophe.jaillet@wanadoo.fr/

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");
 
 	eth->fe_regs = devm_platform_ioremap_resource_byname(pdev, "fe");
 	if (IS_ERR(eth->fe_regs))
@@ -2912,10 +2911,9 @@ static int airoha_probe(struct platform_device *pdev)
 	err = devm_reset_control_bulk_get_exclusive(eth->dev,
 						    ARRAY_SIZE(eth->rsts),
 						    eth->rsts);
-	if (err) {
-		dev_err(eth->dev, "failed to get bulk reset lines\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(eth->dev, err,
+				     "failed to get bulk reset lines\n");
 
 	eth->xsi_rsts[0].id = "xsi-mac";
 	eth->xsi_rsts[1].id = "hsi0-mac";
@@ -2925,10 +2923,9 @@ static int airoha_probe(struct platform_device *pdev)
 	err = devm_reset_control_bulk_get_exclusive(eth->dev,
 						    ARRAY_SIZE(eth->xsi_rsts),
 						    eth->xsi_rsts);
-	if (err) {
-		dev_err(eth->dev, "failed to get bulk xsi reset lines\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(eth->dev, err,
+				     "failed to get bulk xsi reset lines\n");
 
 	eth->napi_dev = alloc_netdev_dummy(0);
 	if (!eth->napi_dev)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port()
  2025-05-15 19:59 [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
                   ` (2 preceding siblings ...)
  2025-05-15 19:59 ` [PATCH v3 4/4] net: airoha: Use dev_err_probe() Christophe JAILLET
@ 2025-05-15 21:16 ` Lorenzo Bianconi
  2025-05-16 20:17   ` Simon Horman
  2025-05-16 20:16 ` Simon Horman
  4 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Bianconi @ 2025-05-15 21:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
	linux-mediatek, netdev

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

> If register_netdev() fails, the error handling path of the probe will not
> free the memory allocated by the previous airoha_metadata_dst_alloc() call
> because port->dev->reg_state will not be NETREG_REGISTERED.
> 
> So, an explicit airoha_metadata_dst_free() call is needed in this case to
> avoid a memory leak.
> 
> Fixes: af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
> Changes in v3:
>   - None
> 
> Changes in v2:
>   - New patch
> v2: https://lore.kernel.org/all/5c94b9b3850f7f29ed653e2205325620df28c3ff.1746715755.git.christophe.jaillet@wanadoo.fr/
> 
> Compile tested only.
> ---
>  drivers/net/ethernet/airoha/airoha_eth.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 16c7896f931f..af8c4015938c 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -2873,7 +2873,15 @@ static int airoha_alloc_gdm_port(struct airoha_eth *eth,
>  	if (err)
>  		return err;
>  
> -	return register_netdev(dev);
> +	err = register_netdev(dev);
> +	if (err)
> +		goto free_metadata_dst;
> +
> +	return 0;
> +
> +free_metadata_dst:
> +	airoha_metadata_dst_free(port);
> +	return err;
>  }
>  
>  static int airoha_probe(struct platform_device *pdev)
> -- 
> 2.49.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port()
  2025-05-15 19:59 [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
                   ` (3 preceding siblings ...)
  2025-05-15 21:16 ` [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Lorenzo Bianconi
@ 2025-05-16 20:16 ` Simon Horman
  2025-05-16 20:21   ` Simon Horman
  4 siblings, 1 reply; 13+ messages in thread
From: Simon Horman @ 2025-05-16 20:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	linux-arm-kernel, linux-mediatek, netdev

On Thu, May 15, 2025 at 09:59:35PM +0200, Christophe JAILLET wrote:
> If register_netdev() fails, the error handling path of the probe will not
> free the memory allocated by the previous airoha_metadata_dst_alloc() call
> because port->dev->reg_state will not be NETREG_REGISTERED.
> 
> So, an explicit airoha_metadata_dst_free() call is needed in this case to
> avoid a memory leak.
> 
> Fixes: af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Changes in v3:
>   - None
> 
> Changes in v2:
>   - New patch
> v2: https://lore.kernel.org/all/5c94b9b3850f7f29ed653e2205325620df28c3ff.1746715755.git.christophe.jaillet@wanadoo.fr/
> 
> Compile tested only.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe()
  2025-05-15 19:59 ` [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
@ 2025-05-16 20:16   ` Simon Horman
  2025-05-24  8:54     ` Christophe JAILLET
  2025-05-17 14:07   ` Lorenzo Bianconi
  1 sibling, 1 reply; 13+ messages in thread
From: Simon Horman @ 2025-05-16 20:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	linux-arm-kernel, linux-mediatek, netdev

On Thu, May 15, 2025 at 09:59:36PM +0200, Christophe JAILLET wrote:
> If an error occurs after a successful airoha_hw_init() call,
> airoha_ppe_deinit() needs to be called as already done in the remove
> function.
> 
> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 4/4] net: airoha: Use dev_err_probe()
  2025-05-15 19:59 ` [PATCH v3 4/4] net: airoha: Use dev_err_probe() Christophe JAILLET
@ 2025-05-16 20:16   ` Simon Horman
  2025-05-17 14:09   ` Lorenzo Bianconi
  1 sibling, 0 replies; 13+ messages in thread
From: Simon Horman @ 2025-05-16 20:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	linux-arm-kernel, linux-mediatek, netdev

On Thu, May 15, 2025 at 09:59:38PM +0200, Christophe JAILLET wrote:
> 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 <christophe.jaillet@wanadoo.fr>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port()
  2025-05-15 21:16 ` [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Lorenzo Bianconi
@ 2025-05-16 20:17   ` Simon Horman
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Horman @ 2025-05-16 20:17 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Christophe JAILLET, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	linux-arm-kernel, linux-mediatek, netdev

On Thu, May 15, 2025 at 11:16:56PM +0200, Lorenzo Bianconi wrote:
> > If register_netdev() fails, the error handling path of the probe will not
> > free the memory allocated by the previous airoha_metadata_dst_alloc() call
> > because port->dev->reg_state will not be NETREG_REGISTERED.
> > 
> > So, an explicit airoha_metadata_dst_free() call is needed in this case to
> > avoid a memory leak.
> > 
> > Fixes: af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port()
  2025-05-16 20:16 ` Simon Horman
@ 2025-05-16 20:21   ` Simon Horman
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Horman @ 2025-05-16 20:21 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	linux-arm-kernel, linux-mediatek, netdev

On Fri, May 16, 2025 at 09:16:13PM +0100, Simon Horman wrote:
> On Thu, May 15, 2025 at 09:59:35PM +0200, Christophe JAILLET wrote:
> > If register_netdev() fails, the error handling path of the probe will not
> > free the memory allocated by the previous airoha_metadata_dst_alloc() call
> > because port->dev->reg_state will not be NETREG_REGISTERED.
> > 
> > So, an explicit airoha_metadata_dst_free() call is needed in this case to
> > avoid a memory leak.
> > 
> > Fixes: af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > Changes in v3:
> >   - None
> > 
> > Changes in v2:
> >   - New patch
> > v2: https://lore.kernel.org/all/5c94b9b3850f7f29ed653e2205325620df28c3ff.1746715755.git.christophe.jaillet@wanadoo.fr/
> > 
> > Compile tested only.
> 
> Reviewed-by: Simon Horman <horms@kernel.org>

Sorry, I was a little too hasty.

This patch looks good to me, but as this is a fix for change
present in net it should be targeted at net.

  Subject: [PATCH v4 net] ...

And it should be split out from the patchset comprising the remaining
patches in this series, which appear to be clean-ups (or at least not
but fixes). This rump patch-set should be targeted at net-next.
And ideally, IMHO, have a cover letter.

  Subject: [PATCH v4 net-next 0/3] ...

Thanks!

-- 
pw-bot: changes-requested

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe()
  2025-05-15 19:59 ` [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
  2025-05-16 20:16   ` Simon Horman
@ 2025-05-17 14:07   ` Lorenzo Bianconi
  1 sibling, 0 replies; 13+ messages in thread
From: Lorenzo Bianconi @ 2025-05-17 14:07 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
	linux-mediatek, netdev

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]

> If an error occurs after a successful airoha_hw_init() call,
> airoha_ppe_deinit() needs to be called as already done in the remove
> function.
> 
> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
> Changes in v3:
>   - call airoha_ppe_deinit() and not airoha_ppe_init()   [Lorenzo Bianconi]
> 
> Changes in v2:
>   - Call airoha_ppe_init() at the right place in the error handling path
>     of the probe   [Lorenzo Bianconi]
> v2: https://lore.kernel.org/all/3791c95da3fa3c3bd2a942210e821d9301362128.1746715755.git.christophe.jaillet@wanadoo.fr/
> 
> v1: https://lore.kernel.org/all/f4a420f3a8b4a6fe72798f9774ec9aff2291522d.1744977434.git.christophe.jaillet@wanadoo.fr/
> 
> Compile tested only.
> ---
>  drivers/net/ethernet/airoha/airoha_eth.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index af8c4015938c..d435179875df 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -2967,6 +2967,7 @@ static int airoha_probe(struct platform_device *pdev)
>  error_napi_stop:
>  	for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
>  		airoha_qdma_stop_napi(&eth->qdma[i]);
> +	airoha_ppe_deinit(eth);
>  error_hw_cleanup:
>  	for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
>  		airoha_hw_cleanup(&eth->qdma[i]);
> -- 
> 2.49.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 4/4] net: airoha: Use dev_err_probe()
  2025-05-15 19:59 ` [PATCH v3 4/4] net: airoha: Use dev_err_probe() Christophe JAILLET
  2025-05-16 20:16   ` Simon Horman
@ 2025-05-17 14:09   ` Lorenzo Bianconi
  1 sibling, 0 replies; 13+ messages in thread
From: Lorenzo Bianconi @ 2025-05-17 14:09 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
	linux-mediatek, netdev

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

> 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 <christophe.jaillet@wanadoo.fr>

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
> Changes in v3:
>   - None
> 
> Changes in v2:
>   - New patch
> v2: https://lore.kernel.org/all/1b67aa9ea0245325c3779d32dde46cdf5c232db9.1746715755.git.christophe.jaillet@wanadoo.fr/
> 
> 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");
>  
>  	eth->fe_regs = devm_platform_ioremap_resource_byname(pdev, "fe");
>  	if (IS_ERR(eth->fe_regs))
> @@ -2912,10 +2911,9 @@ static int airoha_probe(struct platform_device *pdev)
>  	err = devm_reset_control_bulk_get_exclusive(eth->dev,
>  						    ARRAY_SIZE(eth->rsts),
>  						    eth->rsts);
> -	if (err) {
> -		dev_err(eth->dev, "failed to get bulk reset lines\n");
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(eth->dev, err,
> +				     "failed to get bulk reset lines\n");
>  
>  	eth->xsi_rsts[0].id = "xsi-mac";
>  	eth->xsi_rsts[1].id = "hsi0-mac";
> @@ -2925,10 +2923,9 @@ static int airoha_probe(struct platform_device *pdev)
>  	err = devm_reset_control_bulk_get_exclusive(eth->dev,
>  						    ARRAY_SIZE(eth->xsi_rsts),
>  						    eth->xsi_rsts);
> -	if (err) {
> -		dev_err(eth->dev, "failed to get bulk xsi reset lines\n");
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(eth->dev, err,
> +				     "failed to get bulk xsi reset lines\n");
>  
>  	eth->napi_dev = alloc_netdev_dummy(0);
>  	if (!eth->napi_dev)
> -- 
> 2.49.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe()
  2025-05-16 20:16   ` Simon Horman
@ 2025-05-24  8:54     ` Christophe JAILLET
  0 siblings, 0 replies; 13+ messages in thread
From: Christophe JAILLET @ 2025-05-24  8:54 UTC (permalink / raw)
  To: Simon Horman
  Cc: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	linux-arm-kernel, linux-mediatek, netdev

Le 16/05/2025 à 22:16, Simon Horman a écrit :
> On Thu, May 15, 2025 at 09:59:36PM +0200, Christophe JAILLET wrote:
>> If an error occurs after a successful airoha_hw_init() call,
>> airoha_ppe_deinit() needs to be called as already done in the remove
>> function.
>>
>> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> 

Hi,

I guess, that is patch should also be targeted against -net?

CJ

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-05-24  8:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-15 19:59 [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
2025-05-15 19:59 ` [PATCH v3 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
2025-05-16 20:16   ` Simon Horman
2025-05-24  8:54     ` Christophe JAILLET
2025-05-17 14:07   ` Lorenzo Bianconi
2025-05-15 19:59 ` [PATCH v3 3/4] net: airoha: Use for_each_child_of_node_scoped() Christophe JAILLET
2025-05-15 19:59 ` [PATCH v3 4/4] net: airoha: Use dev_err_probe() Christophe JAILLET
2025-05-16 20:16   ` Simon Horman
2025-05-17 14:09   ` Lorenzo Bianconi
2025-05-15 21:16 ` [PATCH v3 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Lorenzo Bianconi
2025-05-16 20:17   ` Simon Horman
2025-05-16 20:16 ` Simon Horman
2025-05-16 20:21   ` Simon Horman

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).