Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net: airoha: Fix variable shadowing in airoha_ppe_flush_sram_entries()
@ 2026-06-12  9:37 Wayen.Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Wayen.Yan @ 2026-06-12  9:37 UTC (permalink / raw)
  To: netdev; +Cc: lorenzo, linux-arm-kernel, linux-mediatek

Hi Lorenzo,

Thank you for the review!

You are right, dropping the outer err variable and returning directly
is cleaner. Updated accordingly in v2.

Regards,
Wayen.Yan


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] net: airoha: Fix variable shadowing in airoha_ppe_flush_sram_entries()
@ 2026-06-11 23:08 Wayen.Yan
  2026-06-12  8:40 ` Lorenzo Bianconi
  0 siblings, 1 reply; 3+ messages in thread
From: Wayen.Yan @ 2026-06-11 23:08 UTC (permalink / raw)
  To: netdev; +Cc: lorenzo, linux-arm-kernel, linux-mediatek

In airoha_ppe_flush_sram_entries(), the inner "int err" declaration
shadows the outer "err" variable. When airoha_ppe_foe_commit_sram_entry()
fails and the loop breaks, the function returns the outer err which is
always 0, silently swallowing the error.

Remove the inner declaration so the assignment writes to the outer
variable and errors are properly propagated.

Fixes: 620d7b91aadb ("net: airoha: ppe: Flush PPE SRAM table during PPE setup")
Signed-off-by: Wayen.Yan <win847@gmail.com>
---
 drivers/net/ethernet/airoha/airoha_ppe.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/airoha/airoha_ppe.c b/drivers/net/ethernet/airoha/airoha_ppe.c
index 5c9dff6..2b849d4 100644
--- a/drivers/net/ethernet/airoha/airoha_ppe.c
+++ b/drivers/net/ethernet/airoha/airoha_ppe.c
@@ -1333,8 +1333,6 @@ static int airoha_ppe_flush_sram_entries(struct airoha_ppe *ppe)
 	int i, err = 0;
 
 	for (i = 0; i < sram_num_entries; i++) {
-		int err;
-
 		memset(&hwe[i], 0, sizeof(*hwe));
 		err = airoha_ppe_foe_commit_sram_entry(ppe, i);
 		if (err)
-- 
2.51.0



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

end of thread, other threads:[~2026-06-12  9:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12  9:37 [PATCH] net: airoha: Fix variable shadowing in airoha_ppe_flush_sram_entries() Wayen.Yan
  -- strict thread matches above, loose matches on Subject: below --
2026-06-11 23:08 Wayen.Yan
2026-06-12  8:40 ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox