Hi Tobias,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net/master]

url:    
https://github.com/0day-ci/linux/commits/Tobias-Waldekranz/net-dsa-Centralize-validation-of-VLAN-configuration/20210316-035618
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 
a25f822285420486f5da434efc8d940d42a83bce
config: powerpc-randconfig-r006-20210316 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
50c7504a93fdb90c26870db8c8ea7add895c7725)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/9a35f7597b676a3bdaa9dd753e0a7d11fb132ed5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Tobias-Waldekranz/net-dsa-Centralize-validation-of-VLAN-configuration/20210316-035618
        git checkout 9a35f7597b676a3bdaa9dd753e0a7d11fb132ed5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All warnings (new ones prefixed by >>):

>> net/dsa/slave.c:2074:12: warning: variable 'err' is used uninitialized 
>> whenever 'if' condition is false [-Wsometimes-uninitialized]
                   else if (is_vlan_dev(info->upper_dev))
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/dsa/slave.c:2077:7: note: uninitialized use occurs here
                   if (err)
                       ^~~
   net/dsa/slave.c:2074:8: note: remove the 'if' if its condition is always true
                   else if (is_vlan_dev(info->upper_dev))
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/dsa/slave.c:2070:10: note: initialize the variable 'err' to silence this 
warning
                   int err;
                          ^
                           = 0
   1 warning generated.


vim +2074 net/dsa/slave.c

  2059  
  2060  static int dsa_slave_netdevice_event(struct notifier_block *nb,
  2061                                       unsigned long event, void *ptr)
  2062  {
  2063          struct net_device *dev = netdev_notifier_info_to_dev(ptr);
  2064  
  2065          switch (event) {
  2066          case NETDEV_PRECHANGEUPPER: {
  2067                  struct netdev_notifier_changeupper_info *info = ptr;
  2068                  struct dsa_switch *ds;
  2069                  struct dsa_port *dp;
  2070                  int err;
  2071  
  2072                  if (is_vlan_dev(dev))
  2073                          err = dsa_prevent_bridging_8021q_upper(dev, 
ptr);
> 2074                  else if (is_vlan_dev(info->upper_dev))
  2075                          err = dsa_slave_check_8021q_upper(dev, ptr);
  2076  
  2077                  if (err)
  2078                          return err;
  2079  
  2080                  if (!dsa_slave_dev_check(dev))
  2081                          return NOTIFY_DONE;
  2082  
  2083                  dp = dsa_slave_to_port(dev);
  2084                  ds = dp->ds;
  2085  
  2086                  if (ds->ops->port_prechangeupper) {
  2087                          err = ds->ops->port_prechangeupper(ds, 
dp->index, info);
  2088                          if (err)
  2089                                  return notifier_from_errno(err);
  2090                  }
  2091                  break;
  2092          }
  2093          case NETDEV_CHANGEUPPER:
  2094                  if (dsa_slave_dev_check(dev))
  2095                          return dsa_slave_changeupper(dev, ptr);
  2096  
  2097                  if (netif_is_lag_master(dev))
  2098                          return dsa_slave_lag_changeupper(dev, ptr);
  2099  
  2100                  break;
  2101          case NETDEV_CHANGELOWERSTATE: {
  2102                  struct netdev_notifier_changelowerstate_info *info = 
ptr;
  2103                  struct dsa_port *dp;
  2104                  int err;
  2105  
  2106                  if (!dsa_slave_dev_check(dev))
  2107                          break;
  2108  
  2109                  dp = dsa_slave_to_port(dev);
  2110  
  2111                  err = dsa_port_lag_change(dp, info->lower_state_info);
  2112                  return notifier_from_errno(err);
  2113          }
  2114          case NETDEV_GOING_DOWN: {
  2115                  struct dsa_port *dp, *cpu_dp;
  2116                  struct dsa_switch_tree *dst;
  2117                  LIST_HEAD(close_list);
  2118  
  2119                  if (!netdev_uses_dsa(dev))
  2120                          return NOTIFY_DONE;
  2121  
  2122                  cpu_dp = dev->dsa_ptr;
  2123                  dst = cpu_dp->ds->dst;
  2124  
  2125                  list_for_each_entry(dp, &dst->ports, list) {
  2126                          if (!dsa_is_user_port(dp->ds, dp->index))
  2127                                  continue;
  2128  
  2129                          list_add(&dp->slave->close_list, &close_list);
  2130                  }
  2131  
  2132                  dev_close_many(&close_list, true);
  2133  
  2134                  return NOTIFY_OK;
  2135          }
  2136          default:
  2137                  break;
  2138          }
  2139  
  2140          return NOTIFY_DONE;
  2141  }
  2142  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to