From: David Miller <davem@davemloft.net>
To: shhuiw@gmail.com
Cc: fubar@us.ibm.com, andy@greyhouse.net, netdev@vger.kernel.org
Subject: Re: [PATCH] bonding: use pre-defined macro in bond_mode_name instead of magic number 0
Date: Fri, 26 Jul 2013 13:54:09 -0700 (PDT) [thread overview]
Message-ID: <20130726.135409.1813499553216352267.davem@davemloft.net> (raw)
In-Reply-To: <51EF79E6.9060309@gmail.com>
From: Wang Sheng-Hui <shhuiw@gmail.com>
Date: Wed, 24 Jul 2013 14:53:26 +0800
> 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];
I applied this version of your patch, thanks.
prev parent reply other threads:[~2013-07-26 20:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130726.135409.1813499553216352267.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=andy@greyhouse.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=shhuiw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).