Re: [bug report] net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 16, 2021 at 01:43:24AM +0100, Lukasz Stelmach wrote:
> It was <2021-11-12 pią 15:36>, when Dan Carpenter wrote:
> > Hello Łukasz Stelmach,
> >
> > The patch a97c69ba4f30: "net: ax88796c: ASIX AX88796C SPI Ethernet
> > Adapter Driver" from Oct 20, 2021, leads to the following Smatch
> > static checker warning:
> >
> > 	drivers/net/ethernet/asix/ax88796c_main.c:391 ax88796c_start_xmit()
> > 	warn: test_bit() takes a bit number
> >
> > drivers/net/ethernet/asix/ax88796c_main.c
> >     382 static int
> >     383 ax88796c_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> >     384 {
> >     385         struct ax88796c_device *ax_local = to_ax88796c_device(ndev);
> >     386 
> >     387         skb_queue_tail(&ax_local->tx_wait_q, skb);
> >     388         if (skb_queue_len(&ax_local->tx_wait_q) > TX_QUEUE_HIGH_WATER)
> >     389                 netif_stop_queue(ndev);
> >     390 
> > --> 391         set_bit(EVENT_TX, &ax_local->flags);
> >
> > EVENT_TX is BIT(1) so this ends up being a double BIT(BIT(1));.  Which
> > is fine because it seems to be done consistently.  But probably it
> > should be:
> >
> > #define EVENT_INTR		0
> > #define EVENT_TX		1
> > #define EVENT_SET_MULTI		2
> >
> 
> Apparently this is a porting artifact. Originally these were defined as
> {1,2,4}[1] so I changed that to BIT(x) without much
> consideration. I am fixing it. Thanks for reporting.

Changing it back to 1,2,4 will hide bug from the Smatch but the correct
values are 0,1,2.

regards,
dan carpenter




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux