netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: dsa_loop: use int type to store negative error codes
@ 2025-09-03 12:34 Qianfeng Rong
  2025-09-03 13:28 ` Vladimir Oltean
  2025-09-04 16:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Qianfeng Rong @ 2025-09-03 12:34 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: Qianfeng Rong

Change the 'ret' variable in dsa_loop_init() from unsigned int to int, as
it needs to store either negative error codes or zero returned by
mdio_driver_register().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing.  Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/net/dsa/dsa_loop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index ad907287a853..8112515d545e 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -399,7 +399,8 @@ static int __init dsa_loop_init(void)
 		.speed = SPEED_100,
 		.duplex = DUPLEX_FULL,
 	};
-	unsigned int i, ret;
+	unsigned int i;
+	int ret;
 
 	for (i = 0; i < NUM_FIXED_PHYS; i++)
 		phydevs[i] = fixed_phy_register(&status, NULL);
-- 
2.34.1


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

* Re: [PATCH] net: dsa: dsa_loop: use int type to store negative error codes
  2025-09-03 12:34 [PATCH] net: dsa: dsa_loop: use int type to store negative error codes Qianfeng Rong
@ 2025-09-03 13:28 ` Vladimir Oltean
  2025-09-04 16:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2025-09-03 13:28 UTC (permalink / raw)
  To: Qianfeng Rong
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel

On Wed, Sep 03, 2025 at 08:34:03PM +0800, Qianfeng Rong wrote:
> Change the 'ret' variable in dsa_loop_init() from unsigned int to int, as
> it needs to store either negative error codes or zero returned by
> mdio_driver_register().
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but can be confusing.  Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

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

* Re: [PATCH] net: dsa: dsa_loop: use int type to store negative error codes
  2025-09-03 12:34 [PATCH] net: dsa: dsa_loop: use int type to store negative error codes Qianfeng Rong
  2025-09-03 13:28 ` Vladimir Oltean
@ 2025-09-04 16:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-04 16:00 UTC (permalink / raw)
  To: Qianfeng Rong
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

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

On Wed,  3 Sep 2025 20:34:03 +0800 you wrote:
> Change the 'ret' variable in dsa_loop_init() from unsigned int to int, as
> it needs to store either negative error codes or zero returned by
> mdio_driver_register().
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but can be confusing.  Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> [...]

Here is the summary with links:
  - net: dsa: dsa_loop: use int type to store negative error codes
    https://git.kernel.org/netdev/net-next/c/a50e7864ca44

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:[~2025-09-04 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03 12:34 [PATCH] net: dsa: dsa_loop: use int type to store negative error codes Qianfeng Rong
2025-09-03 13:28 ` Vladimir Oltean
2025-09-04 16:00 ` 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;
as well as URLs for NNTP newsgroup(s).