Netdev List
 help / color / mirror / Atom feed
* [PATCH net] bnge: use int for bnge_fix_rings_count() return value
@ 2026-08-01 10:09 Alok Tiwari
  2026-08-03  5:36 ` Bhargava Chenna Marreddy
  2026-08-05  1:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alok Tiwari @ 2026-08-01 10:09 UTC (permalink / raw)
  To: rajashekar.hudumula, bhargava.marreddy, vikas.gupta,
	andrew+netdev, davem, edumazet, kuba, pabeni, netdev
  Cc: alok.a.tiwari, alok.a.tiwarilinux

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.

Fixes: 627c67f038d2 ("bng_en: Add resource management support")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/net/ethernet/broadcom/bnge/bnge_resc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
index 0e94f092813e..4711dd4945ff 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
@@ -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


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

* Re: [PATCH net] bnge: use int for bnge_fix_rings_count() return value
  2026-08-01 10:09 [PATCH net] bnge: use int for bnge_fix_rings_count() return value Alok Tiwari
@ 2026-08-03  5:36 ` Bhargava Chenna Marreddy
  2026-08-05  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Bhargava Chenna Marreddy @ 2026-08-03  5:36 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: rajashekar.hudumula, vikas.gupta, andrew+netdev, davem, edumazet,
	kuba, pabeni, netdev, alok.a.tiwarilinux

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

On Sat, Aug 1, 2026 at 3:39 PM Alok Tiwari <alok.a.tiwari@oracle.com> 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 -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.
>
> Fixes: 627c67f038d2 ("bng_en: Add resource management support")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Reviewed-by: Bhargava Marreddy <bhargava.marreddy@broadcom.com>

> ---
>  drivers/net/ethernet/broadcom/bnge/bnge_resc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> index 0e94f092813e..4711dd4945ff 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> @@ -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
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5496 bytes --]

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

* Re: [PATCH net] bnge: use int for bnge_fix_rings_count() return value
  2026-08-01 10:09 [PATCH net] bnge: use int for bnge_fix_rings_count() return value Alok Tiwari
  2026-08-03  5:36 ` Bhargava Chenna Marreddy
@ 2026-08-05  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-05  1:20 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: rajashekar.hudumula, bhargava.marreddy, vikas.gupta,
	andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	alok.a.tiwarilinux

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 -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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-08-05  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-01 10:09 [PATCH net] bnge: use int for bnge_fix_rings_count() return value Alok Tiwari
2026-08-03  5:36 ` Bhargava Chenna Marreddy
2026-08-05  1:20 ` patchwork-bot+netdevbpf

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