From: Stephen Hemminger <stephen@networkplumber.org>
To: Serhey Popovych <serhe.popovych@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2 1/9] iplink: Use ll_index_to_name() instead of if_indextoname()
Date: Wed, 17 Jan 2018 10:53:58 -0800 [thread overview]
Message-ID: <20180117105358.6a0c8083@xeon-e3> (raw)
In-Reply-To: <1515778774-24173-2-git-send-email-serhe.popovych@gmail.com>
On Fri, 12 Jan 2018 19:39:26 +0200
Serhey Popovych <serhe.popovych@gmail.com> wrote:
This looks fine, but minor nuisances from checkpatch
> diff --git a/bridge/fdb.c b/bridge/fdb.c
> index 376713b..2cc0268 100644
> --- a/bridge/fdb.c
> +++ b/bridge/fdb.c
> @@ -219,10 +219,10 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
> unsigned int ifindex = rta_getattr_u32(tb[NDA_IFINDEX]);
>
> if (ifindex) {
> - char ifname[IF_NAMESIZE];
> + const char *ifname;
>
> if (!tb[NDA_LINK_NETNSID] &&
> - if_indextoname(ifindex, ifname)) {
> + (ifname = ll_index_to_name(ifindex))) {
> if (jw_global)
Please rearrange to avoid assignment in conditional.
ifname = ll_index_to_name(ifindex);
if (ifname && !tb[NDA_LINK_NETNSID]) {
> @@ -135,14 +132,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
> print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
>
> if (tb[IFLA_LINK]) {
> - SPRINT_BUF(b1);
> int iflink = rta_getattr_u32(tb[IFLA_LINK]);
>
> - if (iflink == 0)
> - fprintf(fp, "@NONE: ");
> - else
> - fprintf(fp, "@%s: ",
> - if_indextoname(iflink, b1));
> + fprintf(fp, "@%s: ", iflink ? ll_index_to_name(iflink) : "NONE");
Break long line here.
ERROR: do not use assignment in if condition
#265: FILE: ip/link_gre6.c:418:
+ if (tb[IFLA_GRE_LINK] &&
ERROR: do not use assignment in if condition
#296: FILE: ip/link_ip6tnl.c:381:
+ if (tb[IFLA_IPTUN_LINK] &&
ERROR: do not use assignment in if condition
#327: FILE: ip/link_iptnl.c:411:
+ if (tb[IFLA_IPTUN_LINK] &&
ERROR: do not use assignment in if condition
#368: FILE: ip/link_vti6.c:193:
+ if (tb[IFLA_VTI_LINK] &&
next prev parent reply other threads:[~2018-01-17 18:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 17:39 [PATCH iproute2 0/9] ip/tunnel: Improve tunnel parameters printing Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 1/9] iplink: Use ll_index_to_name() instead of if_indextoname() Serhey Popovych
2018-01-17 18:53 ` Stephen Hemminger [this message]
2018-01-12 17:39 ` [PATCH iproute2 2/9] ip/tunnel: Correct and unify ttl/hoplimit printing Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 3/9] ip/tunnel: Simplify and unify tos printing Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 4/9] ip/tunnel: Use print_0xhex() instead of print_string() Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 5/9] ip/tunnel: Use print_string() and simplify encap option printing Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 6/9] gre/tunnel: Print erspan_index using print_uint() Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 7/9] ip/tunnel: Minor cleanups in print routines Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 8/9] vti/tunnel: Unify ikey/okey printing Serhey Popovych
2018-01-12 17:39 ` [PATCH iproute2 9/9] vti6/tunnel: Unify and simplify link type help functions Serhey Popovych
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=20180117105358.6a0c8083@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
--cc=serhe.popovych@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).