bnge: use int for bnge_fix_rings_count() return value
PATCH 1/1 bnge: use int for bnge_fix_rings_count() return value
bnge_fix_rings_count() returns 0 on success or a negative errno on failure However, bnge_adjust_rings() stores its return value in a u16 variable, causing negative error codes such as -ENOMEM to be converted to a large positive value.
Use an int for the return code variable so that error values are preserved and propagated correctly.
--- drivers/net/ethernet/broadcom/bnge/bnge_resc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnge/bnge_resc.c +2 -1
@@ -163,7 +163,8 @@ static int bnge_adjust_rings(struct bnge_dev *bd, u16 *rx,u16 tx_chunks =bnge_num_tx_to_cp (bd, *tx);if (tx_chunks != *tx) { -u16 tx_saved = tx_chunks, rc; +u16 tx_saved = tx_chunks; +int rc; rc =bnge_fix_rings_count (rx, &tx_chunks, max_nq, sh);if (rc)
Signature · 1 line
2.52.0
Quoted 11 lines · Alok Tiwari
bnge_fix_rings_count()returns 0 on success or a negative errno on failure However,bnge_adjust_rings()stores its return value in a u16 variable, causing negative error codes such as-ENOMEMto be converted to a large positive value.Use an int for the return code variable so that error values are preserved and propagated correctly.
Fixes 627c67f038d2 ("bng_en: Add resource management support")Signed-off-by Alok Tiwari <[email protected]>
Quoted 21 lines
--- drivers/net/ethernet/broadcom/bnge/bnge_resc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/broadcom/bnge/bnge_resc.c +2
-2@@ -163,7 +163,8 @@ static int bnge_adjust_rings(struct bnge_dev *bd, u16 *rx,u16 tx_chunks =bnge_num_tx_to_cp (bd, *tx);if (tx_chunks != *tx) { -u16 tx_saved = tx_chunks, rc; +u16 tx_saved = tx_chunks; +int rc; rc =bnge_fix_rings_count (rx, &tx_chunks, max_nq, sh);if (rc) --2.52.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Sat, 1 Aug 2026 03:09:20 -0700 you wrote:
bnge_fix_rings_count()returns 0 on success or a negative errno on failure However,bnge_adjust_rings()stores its return value in a u16 variable, causing negative error codes such as-ENOMEMto be converted to a large positive value.Use an int for the return code variable so that error values are preserved and propagated correctly.
[...]
Here is the summary with links:
- [net] bnge: use int for bnge_fix_rings_count() return value
https://git.kernel.org/netdev/net/c/2cbd8a4e5e09
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html