[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180117105358.6a0c8083@xeon-e3>
Date: Wed, 17 Jan 2018 10:53:58 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Serhey Popovych <serhe.popovych@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 1/9] iplink: Use ll_index_to_name() instead of
if_indextoname()
On Fri, 12 Jan 2018 19:39:26 +0200
Serhey Popovych <serhe.popovych@...il.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] &&
Powered by blists - more mailing lists