Subject: Re: [PATCH net-next 2/2] net: broadcom: bcm4908enet: add BCM4908 controller driver

From: kernel test robot <[email-masked]>
Date: Sat, 6 Feb 2021 07:47:40 +0800

Hi "Rafał,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/dt-bindings-net-document-BCM4908-Ethernet-controller/20210206-055343
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 6626a0266566c5aea16178c5e6cd7fc4db3f2f56
config: i386-randconfig-s001-20210205 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        # https://github.com/0day-ci/linux/commit/53a9af8e34620fcfd9a75ccc9c89862b5c96598d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Rafa-Mi-ecki/dt-bindings-net-document-BCM4908-Ethernet-controller/20210206-055343
        git checkout 53a9af8e34620fcfd9a75ccc9c89862b5c96598d
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

"sparse warnings: (new ones prefixed by >>)"
>> drivers/net/ethernet/broadcom/bcm4908enet.c:274:23: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] ctl @@     got unsigned int [assigned] [usertype] tmp @@
   drivers/net/ethernet/broadcom/bcm4908enet.c:274:23: sparse:     expected restricted __le32 [usertype] ctl
   drivers/net/ethernet/broadcom/bcm4908enet.c:274:23: sparse:     got unsigned int [assigned] [usertype] tmp
>> drivers/net/ethernet/broadcom/bcm4908enet.c:275:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] addr @@     got unsigned int [usertype] dma_addr @@
   drivers/net/ethernet/broadcom/bcm4908enet.c:275:24: sparse:     expected restricted __le32 [usertype] addr
   drivers/net/ethernet/broadcom/bcm4908enet.c:275:24: sparse:     got unsigned int [usertype] dma_addr
>> drivers/net/ethernet/broadcom/bcm4908enet.c:485:29: sparse: sparse: restricted __le32 degrades to integer
   drivers/net/ethernet/broadcom/bcm4908enet.c:505:13: sparse: sparse: restricted __le32 degrades to integer
>> drivers/net/ethernet/broadcom/bcm4908enet.c:525:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] addr @@     got unsigned int [usertype] @@
   drivers/net/ethernet/broadcom/bcm4908enet.c:525:24: sparse:     expected restricted __le32 [usertype] addr
   drivers/net/ethernet/broadcom/bcm4908enet.c:525:24: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/broadcom/bcm4908enet.c:526:23: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] ctl @@     got unsigned int [assigned] [usertype] tmp @@
   drivers/net/ethernet/broadcom/bcm4908enet.c:526:23: sparse:     expected restricted __le32 [usertype] ctl
   drivers/net/ethernet/broadcom/bcm4908enet.c:526:23: sparse:     got unsigned int [assigned] [usertype] tmp
   drivers/net/ethernet/broadcom/bcm4908enet.c:551:29: sparse: sparse: restricted __le32 degrades to integer
   drivers/net/ethernet/broadcom/bcm4908enet.c:564:32: sparse: sparse: restricted __le32 degrades to integer
   drivers/net/ethernet/broadcom/bcm4908enet.c:567:30: sparse: sparse: restricted __le32 degrades to integer

vim +274 drivers/net/ethernet/broadcom/bcm4908enet.c

   246	
   247	static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx)
   248	{
   249		struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
   250		struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
   251		struct device *dev = enet->dev;
   252		u32 tmp;
   253		int err;
   254	
   255		slot->len = ENET_MTU_MAX + ENET_MTU_MAX_EXTRA_SIZE;
   256	
   257		slot->skb = netdev_alloc_skb(enet->netdev, slot->len);
   258		if (!slot->skb)
   259			return -ENOMEM;
   260	
   261		slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, DMA_FROM_DEVICE);
   262		err = dma_mapping_error(dev, slot->dma_addr);
   263		if (err) {
   264			dev_err(dev, "Failed to map DMA buffer: %d\n", err);
   265			kfree_skb(slot->skb);
   266			slot->skb = NULL;
   267			return err;
   268		}
   269	
   270		tmp = slot->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
   271		tmp |= DMA_CTL_STATUS_OWN;
   272		if (idx == enet->rx_ring.length - 1)
   273			tmp |= DMA_CTL_STATUS_WRAP;
 > 274		buf_desc->ctl = tmp;
 > 275		buf_desc->addr = slot->dma_addr;
   276	
   277		return 0;
   278	}
   279	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]