From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger 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 Message-ID: <20180117105358.6a0c8083@xeon-e3> References: <1515778774-24173-1-git-send-email-serhe.popovych@gmail.com> <1515778774-24173-2-git-send-email-serhe.popovych@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Serhey Popovych Return-path: Received: from mail-pg0-f54.google.com ([74.125.83.54]:46344 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754066AbeAQSyI (ORCPT ); Wed, 17 Jan 2018 13:54:08 -0500 Received: by mail-pg0-f54.google.com with SMTP id s9so9945176pgq.13 for ; Wed, 17 Jan 2018 10:54:07 -0800 (PST) In-Reply-To: <1515778774-24173-2-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, 12 Jan 2018 19:39:26 +0200 Serhey Popovych 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] &&