Skip to contentSkip to conversation

net: dsa: sja1105: Add support for Spanning Tree Protocol

bug report Dan Carpenter 1 participant 1 message May 8, 2019 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Vladimir Oltean,

The patch 640f763f98c2: "net: dsa: sja1105: Add support for Spanning Tree Protocol" from May 5, 2019, leads to the following static checker warning:

	drivers/net/dsa/sja1105/sja1105_main.c:1073 sja1105_stp_state_get()
	warn: signedness bug returning '(-22)'

drivers/net/dsa/sja1105/sja1105_main.c
1059 static u8 sja1105_stp_state_get(struct sja1105_private *priv, int port)

               ^^
  1060  {
  1061          struct sja1105_mac_config_entry *mac;
  1062  
  1063          mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
  1064  
  1065          if (!mac[port].ingress && !mac[port].egress && !mac[port].dyn_learn)
  1066                  return BR_STATE_BLOCKING;
  1067          if (mac[port].ingress && !mac[port].egress && !mac[port].dyn_learn)
  1068                  return BR_STATE_LISTENING;
  1069          if (mac[port].ingress && !mac[port].egress && mac[port].dyn_learn)
  1070                  return BR_STATE_LEARNING;
  1071          if (mac[port].ingress && mac[port].egress && mac[port].dyn_learn)
  1072                  return BR_STATE_FORWARDING;
  1073          return -EINVAL;
                ^^^^^^^^^^^^^^

The caller doesn't check for negative errors anyway.

1074 }

regards,
dan carpenter