netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: use pre-defined macro in bond_mode_name instead of magic number 0
@ 2013-07-24  6:53 Wang Sheng-Hui
  2013-07-24  7:10 ` Joe Perches
  2013-07-26 20:54 ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Wang Sheng-Hui @ 2013-07-24  6:53 UTC (permalink / raw)
  To: Jay Vosburgh, Andy Gospodarek, netdev

We have BOND_MODE_ROUNDROBIN pre-defined as 0, and it's the lowest mode number.
Use it to check the arg lower bound instead of magic number 0 in bond_mode_name.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
  drivers/net/bonding/bond_main.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 07f257d4..5890def 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -273,7 +273,7 @@ const char *bond_mode_name(int mode)
  		[BOND_MODE_ALB] = "adaptive load balancing",
  	};

-	if (mode < 0 || mode > BOND_MODE_ALB)
+	if (mode < BOND_MODE_ROUNDROBIN || mode > BOND_MODE_ALB)
  		return "unknown";

  	return names[mode];
-- 
1.7.10.4

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

end of thread, other threads:[~2013-07-26 21:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-24  6:53 [PATCH] bonding: use pre-defined macro in bond_mode_name instead of magic number 0 Wang Sheng-Hui
2013-07-24  7:10 ` Joe Perches
2013-07-24 12:38   ` Wang Sheng-Hui
2013-07-26 20:53   ` David Miller
2013-07-26 20:56     ` Joe Perches
2013-07-26 21:25     ` Joe Perches
2013-07-26 20:54 ` David Miller

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