All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
@ 2022-02-05 11:05 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-05 11:05 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 10132 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Ansuel Smith <ansuelsmth@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0457e5153e0e8420134f60921349099e907264ca
commit: def975307c01191b6f0170048c3724b0ed3348af net: dsa: qca8k: add LAG support
date:   2 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 2 months ago
compiler: nios2-linux-gcc (GCC) 11.2.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> net/core/dev.c:1596:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(UP) N(DOWN) N(REBOOT) N(CHANGE) N(REGISTER) N(UNREGISTER)
    ^
   net/core/dev.c:1597:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(CHANGEMTU) N(CHANGEADDR) N(GOING_DOWN) N(CHANGENAME) N(FEAT_CHANGE)
    ^
   net/core/dev.c:1598:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(BONDING_FAILOVER) N(PRE_UP) N(PRE_TYPE_CHANGE) N(POST_TYPE_CHANGE)
    ^
   net/core/dev.c:1599:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(POST_INIT) N(RELEASE) N(NOTIFY_PEERS) N(JOIN) N(CHANGEUPPER)
    ^
   net/core/dev.c:1600:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(RESEND_IGMP) N(PRECHANGEMTU) N(CHANGEINFODATA) N(BONDING_INFO)
    ^
   net/core/dev.c:1601:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(PRECHANGEUPPER) N(CHANGELOWERSTATE) N(UDP_TUNNEL_PUSH_INFO)
    ^
   net/core/dev.c:1602:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN)
    ^
   net/core/dev.c:1603:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(CVLAN_FILTER_PUSH_INFO) N(CVLAN_FILTER_DROP_INFO)
    ^
   net/core/dev.c:1604:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(SVLAN_FILTER_PUSH_INFO) N(SVLAN_FILTER_DROP_INFO)
    ^
   net/core/dev.c:1605:2: warning: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    N(PRE_CHANGEADDR)
    ^
>> net/core/dev.c:6718:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &upper->list;
    ^
   net/core/dev.c:6735:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &upper->list;
    ^
   net/core/dev.c:6753:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &upper->list;
    ^
   net/core/dev.c:6917:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &lower->list;
    ^
   net/core/dev.c:6959:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &lower->list;
    ^
   net/core/dev.c:6975:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &lower->list;
    ^
   net/core/dev.c:7086:2: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
    *iter = &lower->list;
    ^
>> net/ipv4/tcp_input.c:3465:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return flag & FLAG_DATA_ACKED;
    ^
>> drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
        !val << QCA8K_REG_GOL_TRUNK_SHIFT(id) |
                                              ^
   drivers/net/dsa/qca8k.c:2353:61: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
         !delete << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i) |
                                                               ^
>> drivers/net/dsa/qca8k.c:693:52: warning: Uninitialized variable: val [uninitvar]
    ret = read_poll_timeout(qca8k_mii_read32, ret1, !(val & mask), 0,
                                                      ^

vim +2315 drivers/net/dsa/qca8k.c

def975307c0119 Ansuel Smith 2021-11-23  2287  
def975307c0119 Ansuel Smith 2021-11-23  2288  static int
def975307c0119 Ansuel Smith 2021-11-23  2289  qca8k_lag_refresh_portmap(struct dsa_switch *ds, int port,
def975307c0119 Ansuel Smith 2021-11-23  2290  			  struct net_device *lag, bool delete)
def975307c0119 Ansuel Smith 2021-11-23  2291  {
def975307c0119 Ansuel Smith 2021-11-23  2292  	struct qca8k_priv *priv = ds->priv;
def975307c0119 Ansuel Smith 2021-11-23  2293  	int ret, id, i;
def975307c0119 Ansuel Smith 2021-11-23  2294  	u32 val;
def975307c0119 Ansuel Smith 2021-11-23  2295  
def975307c0119 Ansuel Smith 2021-11-23  2296  	id = dsa_lag_id(ds->dst, lag);
def975307c0119 Ansuel Smith 2021-11-23  2297  
def975307c0119 Ansuel Smith 2021-11-23  2298  	/* Read current port member */
def975307c0119 Ansuel Smith 2021-11-23  2299  	ret = regmap_read(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL0, &val);
def975307c0119 Ansuel Smith 2021-11-23  2300  	if (ret)
def975307c0119 Ansuel Smith 2021-11-23  2301  		return ret;
def975307c0119 Ansuel Smith 2021-11-23  2302  
def975307c0119 Ansuel Smith 2021-11-23  2303  	/* Shift val to the correct trunk */
def975307c0119 Ansuel Smith 2021-11-23  2304  	val >>= QCA8K_REG_GOL_TRUNK_SHIFT(id);
def975307c0119 Ansuel Smith 2021-11-23  2305  	val &= QCA8K_REG_GOL_TRUNK_MEMBER_MASK;
def975307c0119 Ansuel Smith 2021-11-23  2306  	if (delete)
def975307c0119 Ansuel Smith 2021-11-23  2307  		val &= ~BIT(port);
def975307c0119 Ansuel Smith 2021-11-23  2308  	else
def975307c0119 Ansuel Smith 2021-11-23  2309  		val |= BIT(port);
def975307c0119 Ansuel Smith 2021-11-23  2310  
def975307c0119 Ansuel Smith 2021-11-23  2311  	/* Update port member. With empty portmap disable trunk */
def975307c0119 Ansuel Smith 2021-11-23  2312  	ret = regmap_update_bits(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL0,
def975307c0119 Ansuel Smith 2021-11-23  2313  				 QCA8K_REG_GOL_TRUNK_MEMBER(id) |
def975307c0119 Ansuel Smith 2021-11-23  2314  				 QCA8K_REG_GOL_TRUNK_EN(id),
def975307c0119 Ansuel Smith 2021-11-23 @2315  				 !val << QCA8K_REG_GOL_TRUNK_SHIFT(id) |
def975307c0119 Ansuel Smith 2021-11-23  2316  				 val << QCA8K_REG_GOL_TRUNK_SHIFT(id));
def975307c0119 Ansuel Smith 2021-11-23  2317  
def975307c0119 Ansuel Smith 2021-11-23  2318  	/* Search empty member if adding or port on deleting */
def975307c0119 Ansuel Smith 2021-11-23  2319  	for (i = 0; i < QCA8K_NUM_PORTS_FOR_LAG; i++) {
def975307c0119 Ansuel Smith 2021-11-23  2320  		ret = regmap_read(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL(id), &val);
def975307c0119 Ansuel Smith 2021-11-23  2321  		if (ret)
def975307c0119 Ansuel Smith 2021-11-23  2322  			return ret;
def975307c0119 Ansuel Smith 2021-11-23  2323  
def975307c0119 Ansuel Smith 2021-11-23  2324  		val >>= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i);
def975307c0119 Ansuel Smith 2021-11-23  2325  		val &= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_MASK;
def975307c0119 Ansuel Smith 2021-11-23  2326  
def975307c0119 Ansuel Smith 2021-11-23  2327  		if (delete) {
def975307c0119 Ansuel Smith 2021-11-23  2328  			/* If port flagged to be disabled assume this member is
def975307c0119 Ansuel Smith 2021-11-23  2329  			 * empty
def975307c0119 Ansuel Smith 2021-11-23  2330  			 */
def975307c0119 Ansuel Smith 2021-11-23  2331  			if (val != QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN_MASK)
def975307c0119 Ansuel Smith 2021-11-23  2332  				continue;
def975307c0119 Ansuel Smith 2021-11-23  2333  
def975307c0119 Ansuel Smith 2021-11-23  2334  			val &= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_PORT_MASK;
def975307c0119 Ansuel Smith 2021-11-23  2335  			if (val != port)
def975307c0119 Ansuel Smith 2021-11-23  2336  				continue;
def975307c0119 Ansuel Smith 2021-11-23  2337  		} else {
def975307c0119 Ansuel Smith 2021-11-23  2338  			/* If port flagged to be enabled assume this member is
def975307c0119 Ansuel Smith 2021-11-23  2339  			 * already set
def975307c0119 Ansuel Smith 2021-11-23  2340  			 */
def975307c0119 Ansuel Smith 2021-11-23  2341  			if (val == QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN_MASK)
def975307c0119 Ansuel Smith 2021-11-23  2342  				continue;
def975307c0119 Ansuel Smith 2021-11-23  2343  		}
def975307c0119 Ansuel Smith 2021-11-23  2344  
def975307c0119 Ansuel Smith 2021-11-23  2345  		/* We have found the member to add/remove */
def975307c0119 Ansuel Smith 2021-11-23  2346  		break;
def975307c0119 Ansuel Smith 2021-11-23  2347  	}
def975307c0119 Ansuel Smith 2021-11-23  2348  
def975307c0119 Ansuel Smith 2021-11-23  2349  	/* Set port in the correct port mask or disable port if in delete mode */
def975307c0119 Ansuel Smith 2021-11-23  2350  	return regmap_update_bits(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL(id),
def975307c0119 Ansuel Smith 2021-11-23  2351  				  QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN(id, i) |
def975307c0119 Ansuel Smith 2021-11-23  2352  				  QCA8K_REG_GOL_TRUNK_ID_MEM_ID_PORT(id, i),
def975307c0119 Ansuel Smith 2021-11-23  2353  				  !delete << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i) |
def975307c0119 Ansuel Smith 2021-11-23  2354  				  port << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i));
def975307c0119 Ansuel Smith 2021-11-23  2355  }
def975307c0119 Ansuel Smith 2021-11-23  2356  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
@ 2022-02-10 12:35 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-10 12:35 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9149 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Ansuel Smith <ansuelsmth@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f4bc5bbb5fef3cf421ba3485d6d383c27ec473ed
commit: def975307c01191b6f0170048c3724b0ed3348af net: dsa: qca8k: add LAG support
date:   3 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 3 months ago
compiler: h8300-linux-gcc (GCC) 11.2.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/net/ethernet/freescale/fec_main.c:935:34: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
     writel(rxq->bd.dma, fep->hwp + FEC_R_DES_START(i));
                                    ^
   drivers/net/ethernet/freescale/fec_main.c:936:38: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
     writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_R_BUFF_SIZE(i));
                                        ^
   drivers/net/ethernet/freescale/fec_main.c:941:22: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
             fep->hwp + FEC_RCMR(i));
                        ^
   drivers/net/ethernet/freescale/fec_main.c:946:34: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
     writel(txq->bd.dma, fep->hwp + FEC_X_DES_START(i));
                                    ^
   drivers/net/ethernet/freescale/fec_main.c:950:26: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
      writel(DMA_CLASS_EN | IDLE_SLOPE(i),
                            ^
   drivers/net/ethernet/freescale/fec_main.c:951:22: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
             fep->hwp + FEC_DMA_CFG(i));
                        ^
>> drivers/net/ethernet/freescale/fec_main.c:3309:18: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour. See condition at line 3306. [shiftTooManyBitsSigned]
      hash_low |= 1 << hash;
                    ^
   drivers/net/ethernet/freescale/fec_main.c:3306:12: note: Assuming that condition 'hash>31' is not redundant
     if (hash > 31)
              ^
   drivers/net/ethernet/freescale/fec_main.c:3309:18: note: Shift
      hash_low |= 1 << hash;
                    ^
>> drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
        !val << QCA8K_REG_GOL_TRUNK_SHIFT(id) |
                                              ^
   drivers/net/dsa/qca8k.c:2353:61: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
         !delete << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i) |
                                                               ^
>> drivers/net/dsa/qca8k.c:693:52: warning: Uninitialized variable: val [uninitvar]
    ret = read_poll_timeout(qca8k_mii_read32, ret1, !(val & mask), 0,
                                                      ^
>> drivers/net/ethernet/broadcom/genet/bcmgenet.c:484:15: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour. See condition at line 483. [shiftTooManyBitsSigned]
     reg1 &= ~(1 << (f_index % 32));
                 ^
   drivers/net/ethernet/broadcom/genet/bcmgenet.c:483:15: note: Assuming that condition 'f_index<32' is not redundant
    if  (f_index < 32) {
                 ^
   drivers/net/ethernet/broadcom/genet/bcmgenet.c:484:15: note: Shift
     reg1 &= ~(1 << (f_index % 32));
                 ^

vim +2315 drivers/net/dsa/qca8k.c

def975307c0119 Ansuel Smith 2021-11-23  2287  
def975307c0119 Ansuel Smith 2021-11-23  2288  static int
def975307c0119 Ansuel Smith 2021-11-23  2289  qca8k_lag_refresh_portmap(struct dsa_switch *ds, int port,
def975307c0119 Ansuel Smith 2021-11-23  2290  			  struct net_device *lag, bool delete)
def975307c0119 Ansuel Smith 2021-11-23  2291  {
def975307c0119 Ansuel Smith 2021-11-23  2292  	struct qca8k_priv *priv = ds->priv;
def975307c0119 Ansuel Smith 2021-11-23  2293  	int ret, id, i;
def975307c0119 Ansuel Smith 2021-11-23  2294  	u32 val;
def975307c0119 Ansuel Smith 2021-11-23  2295  
def975307c0119 Ansuel Smith 2021-11-23  2296  	id = dsa_lag_id(ds->dst, lag);
def975307c0119 Ansuel Smith 2021-11-23  2297  
def975307c0119 Ansuel Smith 2021-11-23  2298  	/* Read current port member */
def975307c0119 Ansuel Smith 2021-11-23  2299  	ret = regmap_read(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL0, &val);
def975307c0119 Ansuel Smith 2021-11-23  2300  	if (ret)
def975307c0119 Ansuel Smith 2021-11-23  2301  		return ret;
def975307c0119 Ansuel Smith 2021-11-23  2302  
def975307c0119 Ansuel Smith 2021-11-23  2303  	/* Shift val to the correct trunk */
def975307c0119 Ansuel Smith 2021-11-23  2304  	val >>= QCA8K_REG_GOL_TRUNK_SHIFT(id);
def975307c0119 Ansuel Smith 2021-11-23  2305  	val &= QCA8K_REG_GOL_TRUNK_MEMBER_MASK;
def975307c0119 Ansuel Smith 2021-11-23  2306  	if (delete)
def975307c0119 Ansuel Smith 2021-11-23  2307  		val &= ~BIT(port);
def975307c0119 Ansuel Smith 2021-11-23  2308  	else
def975307c0119 Ansuel Smith 2021-11-23  2309  		val |= BIT(port);
def975307c0119 Ansuel Smith 2021-11-23  2310  
def975307c0119 Ansuel Smith 2021-11-23  2311  	/* Update port member. With empty portmap disable trunk */
def975307c0119 Ansuel Smith 2021-11-23  2312  	ret = regmap_update_bits(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL0,
def975307c0119 Ansuel Smith 2021-11-23  2313  				 QCA8K_REG_GOL_TRUNK_MEMBER(id) |
def975307c0119 Ansuel Smith 2021-11-23  2314  				 QCA8K_REG_GOL_TRUNK_EN(id),
def975307c0119 Ansuel Smith 2021-11-23 @2315  				 !val << QCA8K_REG_GOL_TRUNK_SHIFT(id) |
def975307c0119 Ansuel Smith 2021-11-23  2316  				 val << QCA8K_REG_GOL_TRUNK_SHIFT(id));
def975307c0119 Ansuel Smith 2021-11-23  2317  
def975307c0119 Ansuel Smith 2021-11-23  2318  	/* Search empty member if adding or port on deleting */
def975307c0119 Ansuel Smith 2021-11-23  2319  	for (i = 0; i < QCA8K_NUM_PORTS_FOR_LAG; i++) {
def975307c0119 Ansuel Smith 2021-11-23  2320  		ret = regmap_read(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL(id), &val);
def975307c0119 Ansuel Smith 2021-11-23  2321  		if (ret)
def975307c0119 Ansuel Smith 2021-11-23  2322  			return ret;
def975307c0119 Ansuel Smith 2021-11-23  2323  
def975307c0119 Ansuel Smith 2021-11-23  2324  		val >>= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i);
def975307c0119 Ansuel Smith 2021-11-23  2325  		val &= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_MASK;
def975307c0119 Ansuel Smith 2021-11-23  2326  
def975307c0119 Ansuel Smith 2021-11-23  2327  		if (delete) {
def975307c0119 Ansuel Smith 2021-11-23  2328  			/* If port flagged to be disabled assume this member is
def975307c0119 Ansuel Smith 2021-11-23  2329  			 * empty
def975307c0119 Ansuel Smith 2021-11-23  2330  			 */
def975307c0119 Ansuel Smith 2021-11-23  2331  			if (val != QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN_MASK)
def975307c0119 Ansuel Smith 2021-11-23  2332  				continue;
def975307c0119 Ansuel Smith 2021-11-23  2333  
def975307c0119 Ansuel Smith 2021-11-23  2334  			val &= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_PORT_MASK;
def975307c0119 Ansuel Smith 2021-11-23  2335  			if (val != port)
def975307c0119 Ansuel Smith 2021-11-23  2336  				continue;
def975307c0119 Ansuel Smith 2021-11-23  2337  		} else {
def975307c0119 Ansuel Smith 2021-11-23  2338  			/* If port flagged to be enabled assume this member is
def975307c0119 Ansuel Smith 2021-11-23  2339  			 * already set
def975307c0119 Ansuel Smith 2021-11-23  2340  			 */
def975307c0119 Ansuel Smith 2021-11-23  2341  			if (val == QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN_MASK)
def975307c0119 Ansuel Smith 2021-11-23  2342  				continue;
def975307c0119 Ansuel Smith 2021-11-23  2343  		}
def975307c0119 Ansuel Smith 2021-11-23  2344  
def975307c0119 Ansuel Smith 2021-11-23  2345  		/* We have found the member to add/remove */
def975307c0119 Ansuel Smith 2021-11-23  2346  		break;
def975307c0119 Ansuel Smith 2021-11-23  2347  	}
def975307c0119 Ansuel Smith 2021-11-23  2348  
def975307c0119 Ansuel Smith 2021-11-23  2349  	/* Set port in the correct port mask or disable port if in delete mode */
def975307c0119 Ansuel Smith 2021-11-23  2350  	return regmap_update_bits(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL(id),
def975307c0119 Ansuel Smith 2021-11-23  2351  				  QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN(id, i) |
def975307c0119 Ansuel Smith 2021-11-23  2352  				  QCA8K_REG_GOL_TRUNK_ID_MEM_ID_PORT(id, i),
def975307c0119 Ansuel Smith 2021-11-23  2353  				  !delete << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i) |
def975307c0119 Ansuel Smith 2021-11-23  2354  				  port << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i));
def975307c0119 Ansuel Smith 2021-11-23  2355  }
def975307c0119 Ansuel Smith 2021-11-23  2356  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
@ 2022-01-18  1:21 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-18  1:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6850 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Ansuel Smith <ansuelsmth@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0c947b893d69231a9add855939da7c66237ab44f
commit: def975307c01191b6f0170048c3724b0ed3348af net: dsa: qca8k: add LAG support
date:   8 weeks ago
:::::: branch date: 17 hours ago
:::::: commit date: 8 weeks ago
compiler: arceb-elf-gcc (GCC) 11.2.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
        !val << QCA8K_REG_GOL_TRUNK_SHIFT(id) |
                                              ^
   drivers/net/dsa/qca8k.c:2353:61: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
         !delete << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i) |
                                                               ^
>> drivers/net/dsa/qca8k.c:693:52: warning: Uninitialized variable: val [uninitvar]
    ret = read_poll_timeout(qca8k_mii_read32, ret1, !(val & mask), 0,
                                                      ^

vim +2315 drivers/net/dsa/qca8k.c

def975307c01191 Ansuel Smith 2021-11-23  2287  
def975307c01191 Ansuel Smith 2021-11-23  2288  static int
def975307c01191 Ansuel Smith 2021-11-23  2289  qca8k_lag_refresh_portmap(struct dsa_switch *ds, int port,
def975307c01191 Ansuel Smith 2021-11-23  2290  			  struct net_device *lag, bool delete)
def975307c01191 Ansuel Smith 2021-11-23  2291  {
def975307c01191 Ansuel Smith 2021-11-23  2292  	struct qca8k_priv *priv = ds->priv;
def975307c01191 Ansuel Smith 2021-11-23  2293  	int ret, id, i;
def975307c01191 Ansuel Smith 2021-11-23  2294  	u32 val;
def975307c01191 Ansuel Smith 2021-11-23  2295  
def975307c01191 Ansuel Smith 2021-11-23  2296  	id = dsa_lag_id(ds->dst, lag);
def975307c01191 Ansuel Smith 2021-11-23  2297  
def975307c01191 Ansuel Smith 2021-11-23  2298  	/* Read current port member */
def975307c01191 Ansuel Smith 2021-11-23  2299  	ret = regmap_read(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL0, &val);
def975307c01191 Ansuel Smith 2021-11-23  2300  	if (ret)
def975307c01191 Ansuel Smith 2021-11-23  2301  		return ret;
def975307c01191 Ansuel Smith 2021-11-23  2302  
def975307c01191 Ansuel Smith 2021-11-23  2303  	/* Shift val to the correct trunk */
def975307c01191 Ansuel Smith 2021-11-23  2304  	val >>= QCA8K_REG_GOL_TRUNK_SHIFT(id);
def975307c01191 Ansuel Smith 2021-11-23  2305  	val &= QCA8K_REG_GOL_TRUNK_MEMBER_MASK;
def975307c01191 Ansuel Smith 2021-11-23  2306  	if (delete)
def975307c01191 Ansuel Smith 2021-11-23  2307  		val &= ~BIT(port);
def975307c01191 Ansuel Smith 2021-11-23  2308  	else
def975307c01191 Ansuel Smith 2021-11-23  2309  		val |= BIT(port);
def975307c01191 Ansuel Smith 2021-11-23  2310  
def975307c01191 Ansuel Smith 2021-11-23  2311  	/* Update port member. With empty portmap disable trunk */
def975307c01191 Ansuel Smith 2021-11-23  2312  	ret = regmap_update_bits(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL0,
def975307c01191 Ansuel Smith 2021-11-23  2313  				 QCA8K_REG_GOL_TRUNK_MEMBER(id) |
def975307c01191 Ansuel Smith 2021-11-23  2314  				 QCA8K_REG_GOL_TRUNK_EN(id),
def975307c01191 Ansuel Smith 2021-11-23 @2315  				 !val << QCA8K_REG_GOL_TRUNK_SHIFT(id) |
def975307c01191 Ansuel Smith 2021-11-23  2316  				 val << QCA8K_REG_GOL_TRUNK_SHIFT(id));
def975307c01191 Ansuel Smith 2021-11-23  2317  
def975307c01191 Ansuel Smith 2021-11-23  2318  	/* Search empty member if adding or port on deleting */
def975307c01191 Ansuel Smith 2021-11-23  2319  	for (i = 0; i < QCA8K_NUM_PORTS_FOR_LAG; i++) {
def975307c01191 Ansuel Smith 2021-11-23  2320  		ret = regmap_read(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL(id), &val);
def975307c01191 Ansuel Smith 2021-11-23  2321  		if (ret)
def975307c01191 Ansuel Smith 2021-11-23  2322  			return ret;
def975307c01191 Ansuel Smith 2021-11-23  2323  
def975307c01191 Ansuel Smith 2021-11-23  2324  		val >>= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i);
def975307c01191 Ansuel Smith 2021-11-23  2325  		val &= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_MASK;
def975307c01191 Ansuel Smith 2021-11-23  2326  
def975307c01191 Ansuel Smith 2021-11-23  2327  		if (delete) {
def975307c01191 Ansuel Smith 2021-11-23  2328  			/* If port flagged to be disabled assume this member is
def975307c01191 Ansuel Smith 2021-11-23  2329  			 * empty
def975307c01191 Ansuel Smith 2021-11-23  2330  			 */
def975307c01191 Ansuel Smith 2021-11-23  2331  			if (val != QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN_MASK)
def975307c01191 Ansuel Smith 2021-11-23  2332  				continue;
def975307c01191 Ansuel Smith 2021-11-23  2333  
def975307c01191 Ansuel Smith 2021-11-23  2334  			val &= QCA8K_REG_GOL_TRUNK_ID_MEM_ID_PORT_MASK;
def975307c01191 Ansuel Smith 2021-11-23  2335  			if (val != port)
def975307c01191 Ansuel Smith 2021-11-23  2336  				continue;
def975307c01191 Ansuel Smith 2021-11-23  2337  		} else {
def975307c01191 Ansuel Smith 2021-11-23  2338  			/* If port flagged to be enabled assume this member is
def975307c01191 Ansuel Smith 2021-11-23  2339  			 * already set
def975307c01191 Ansuel Smith 2021-11-23  2340  			 */
def975307c01191 Ansuel Smith 2021-11-23  2341  			if (val == QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN_MASK)
def975307c01191 Ansuel Smith 2021-11-23  2342  				continue;
def975307c01191 Ansuel Smith 2021-11-23  2343  		}
def975307c01191 Ansuel Smith 2021-11-23  2344  
def975307c01191 Ansuel Smith 2021-11-23  2345  		/* We have found the member to add/remove */
def975307c01191 Ansuel Smith 2021-11-23  2346  		break;
def975307c01191 Ansuel Smith 2021-11-23  2347  	}
def975307c01191 Ansuel Smith 2021-11-23  2348  
def975307c01191 Ansuel Smith 2021-11-23  2349  	/* Set port in the correct port mask or disable port if in delete mode */
def975307c01191 Ansuel Smith 2021-11-23  2350  	return regmap_update_bits(priv->regmap, QCA8K_REG_GOL_TRUNK_CTRL(id),
def975307c01191 Ansuel Smith 2021-11-23  2351  				  QCA8K_REG_GOL_TRUNK_ID_MEM_ID_EN(id, i) |
def975307c01191 Ansuel Smith 2021-11-23  2352  				  QCA8K_REG_GOL_TRUNK_ID_MEM_ID_PORT(id, i),
def975307c01191 Ansuel Smith 2021-11-23  2353  				  !delete << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i) |
def975307c01191 Ansuel Smith 2021-11-23  2354  				  port << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i));
def975307c01191 Ansuel Smith 2021-11-23  2355  }
def975307c01191 Ansuel Smith 2021-11-23  2356  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-10 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-05 11:05 drivers/net/dsa/qca8k.c:2315:44: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-02-10 12:35 kernel test robot
2022-01-18  1:21 kernel test robot

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.