From: Jakub Kicinski <kuba@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guo Zhengkui <guozhengkui@vivo.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Colin Ian King <colin.king@intel.com>,
Jiasheng Jiang <jiasheng@iscas.ac.cn>,
"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
zhengkui_guo@outlook.com
Subject: Re: [PATCH linux-next] net: smc911x: replace ternary operator with min()
Date: Wed, 18 May 2022 08:33:44 -0700 [thread overview]
Message-ID: <20220518083344.0886bd6f@kernel.org> (raw)
In-Reply-To: <CAMuHMdWH1rdP22VnhR_h601tm+DDo7+sGdXR-6NQx0B-jGoZ1A@mail.gmail.com>
On Wed, 18 May 2022 11:07:08 +0200 Geert Uytterhoeven wrote:
> On Mon, May 16, 2022 at 10:36 PM Guo Zhengkui <guozhengkui@vivo.com> wrote:
> > Fix the following coccicheck warning:
> >
> > drivers/net/ethernet/smsc/smc911x.c:483:20-22: WARNING opportunity for min()
> >
> > Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
>
> Thanks for your patch, which is now commit 5ff0348b7f755aac ("net:
> smc911x: replace ternary operator with min()") in net-next/master.
>
> > --- a/drivers/net/ethernet/smsc/smc911x.c
> > +++ b/drivers/net/ethernet/smsc/smc911x.c
> > @@ -480,7 +480,7 @@ static void smc911x_hardware_send_pkt(struct net_device *dev)
> > SMC_SET_TX_FIFO(lp, cmdB);
> >
> > DBG(SMC_DEBUG_PKTS, dev, "Transmitted packet\n");
> > - PRINT_PKT(buf, len <= 64 ? len : 64);
> > + PRINT_PKT(buf, min(len, 64));
>
> Unfortunately you forgot to test-compile this with
> ENABLE_SMC_DEBUG_PKTS=1, which triggers:
>
> drivers/net/ethernet/smsc/smc911x.c: In function
> ‘smc911x_hardware_send_pkt’:
> include/linux/minmax.h:20:28: error: comparison of distinct
> pointer types lacks a cast [-Werror]
> 20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
> | ^~
> drivers/net/ethernet/smsc/smc911x.c:483:17: note: in expansion
> of macro ‘min’
> 483 | PRINT_PKT(buf, min(len, 64));
>
> "len" is "unsigned int", while "64" is "(signed) int".
Ah, damn. I did double check that the build test actually compiles
smc911x.o 'cause this patch looked suspicious. Didn't realize that
more than allmodconfig is needed to trigger this :/
How do you enable ENABLE_SMC_DEBUG_PKTS? You edit the source?
> I have sent a fix
> https://lore.kernel.org/r/ca032d4122fc70d3a56a524e5944a8eff9a329e8.1652864652.git.geert+renesas@glider.be/
Thanks a lot!
next prev parent reply other threads:[~2022-05-18 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 11:56 [PATCH linux-next] net: smc911x: replace ternary operator with min() Guo Zhengkui
2022-05-18 0:50 ` patchwork-bot+netdevbpf
2022-05-18 9:07 ` Geert Uytterhoeven
2022-05-18 15:33 ` Jakub Kicinski [this message]
2022-05-18 15:38 ` Geert Uytterhoeven
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=20220518083344.0886bd6f@kernel.org \
--to=kuba@kernel.org \
--cc=colin.king@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert@linux-m68k.org \
--cc=guozhengkui@vivo.com \
--cc=jiasheng@iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhengkui_guo@outlook.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.