Skip to content

Commit 3b2c4f4

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sja1105: Don't return a negative in u8 sja1105_stp_state_get
Dan Carpenter says: The patch 640f763: "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)' The caller doesn't check for negative errors anyway. Fixes: 640f763: ("net: dsa: sja1105: Add support for Spanning Tree Protocol") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5425711 commit 3b2c4f4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,11 @@ static u8 sja1105_stp_state_get(struct sja1105_private *priv, int port)
10701070
return BR_STATE_LEARNING;
10711071
if (mac[port].ingress && mac[port].egress && mac[port].dyn_learn)
10721072
return BR_STATE_FORWARDING;
1073-
return -EINVAL;
1073+
/* This is really an error condition if the MAC was in none of the STP
1074+
* states above. But treating the port as disabled does nothing, which
1075+
* is adequate, and it also resets the MAC to a known state later on.
1076+
*/
1077+
return BR_STATE_DISABLED;
10741078
}
10751079

10761080
/* For situations where we need to change a setting at runtime that is only

0 commit comments

Comments
 (0)