Hi Heng,

kernel test robot noticed the following build warnings:

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

url:    
https://github.com/intel-lab-lkp/linux/commits/Heng-Qi/virtio_net-passing-control_buf-explicitly/20240606-141748
base:   net-next/main
patch link:    
https://lore.kernel.org/r/20240606061446.127802-5-hengqi%40linux.alibaba.com
patch subject: [PATCH net-next v3 4/4] virtio_net: improve dim command request 
efficiency
config: sh-allmodconfig 
(https://download.01.org/0day-ci/archive/20240607/202406070616.vnsljtt2-...@intel.com/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240607/202406070616.vnsljtt2-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202406070616.vnsljtt2-...@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/virtio_net.c: In function 'virtnet_get_cvq_work':
>> drivers/net/virtio_net.c:2841:20: warning: suggest explicit braces to avoid 
>> ambiguous 'else' [-Wdangling-else]
    2841 |                 if (wait_coal)
         |                    ^


vim +/else +2841 drivers/net/virtio_net.c

  2813  
  2814  static void virtnet_get_cvq_work(struct work_struct *work)
  2815  {
  2816          struct virtnet_info *vi =
  2817                  container_of(work, struct virtnet_info, get_cvq);
  2818          struct virtnet_coal_node *wait_coal;
  2819          bool valid = false;
  2820          unsigned int tmp;
  2821          void *res;
  2822  
  2823          mutex_lock(&vi->cvq_lock);
  2824          while ((res = virtqueue_get_buf(vi->cvq, &tmp)) != NULL) {
  2825                  complete((struct completion *)res);
  2826                  valid = true;
  2827          }
  2828          mutex_unlock(&vi->cvq_lock);
  2829  
  2830          if (!valid)
  2831                  return;
  2832  
  2833          while (true) {
  2834                  wait_coal = NULL;
  2835                  mutex_lock(&vi->coal_wait_lock);
  2836                  if (!list_empty(&vi->coal_wait_list))
  2837                          wait_coal = 
list_first_entry(&vi->coal_wait_list,
  2838                                                       struct 
virtnet_coal_node,
  2839                                                       list);
  2840                  mutex_unlock(&vi->coal_wait_lock);
> 2841                  if (wait_coal)
  2842                          if (virtnet_add_dim_command(vi, wait_coal))
  2843                                  break;
  2844                  else
  2845                          break;
  2846          }
  2847  }
  2848  static int virtnet_set_mac_address(struct net_device *dev, void *p)
  2849  {
  2850          struct virtnet_info *vi = netdev_priv(dev);
  2851          struct virtio_device *vdev = vi->vdev;
  2852          int ret;
  2853          struct sockaddr *addr;
  2854          struct scatterlist sg;
  2855  
  2856          if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STANDBY))
  2857                  return -EOPNOTSUPP;
  2858  
  2859          addr = kmemdup(p, sizeof(*addr), GFP_KERNEL);
  2860          if (!addr)
  2861                  return -ENOMEM;
  2862  
  2863          ret = eth_prepare_mac_addr_change(dev, addr);
  2864          if (ret)
  2865                  goto out;
  2866  
  2867          if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
  2868                  sg_init_one(&sg, addr->sa_data, dev->addr_len);
  2869                  if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC,
  2870                                            VIRTIO_NET_CTRL_MAC_ADDR_SET, 
&sg)) {
  2871                          dev_warn(&vdev->dev,
  2872                                   "Failed to set mac address by vq 
command.\n");
  2873                          ret = -EINVAL;
  2874                          goto out;
  2875                  }
  2876          } else if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC) &&
  2877                     !virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) {
  2878                  unsigned int i;
  2879  
  2880                  /* Naturally, this has an atomicity problem. */
  2881                  for (i = 0; i < dev->addr_len; i++)
  2882                          virtio_cwrite8(vdev,
  2883                                         offsetof(struct 
virtio_net_config, mac) +
  2884                                         i, addr->sa_data[i]);
  2885          }
  2886  
  2887          eth_commit_mac_addr_change(dev, p);
  2888          ret = 0;
  2889  
  2890  out:
  2891          kfree(addr);
  2892          return ret;
  2893  }
  2894  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to