On Sat, Jun 01, 2019 at 01:37:34PM +0300, Vladimir Oltean wrote: > The code in sja1105_adjust_port_config relies on the fact that an > invalid link speed is detected by sja1105_get_speed_cfg and returned as > -EINVAL. However storing this into an enum that only has positive > members will cast it into an unsigned value, and it will miss the > negative check. > > So make the -EINVAL value part of the enum, so that it is stored as a > signed number and passes the negative check. > > Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 > switch") > Signed-off-by: Vladimir Oltean <olte...@gmail.com>
Hi Vladimir It seems like just using a switch statement would be simpler, and more likely to be correct. And it would avoid adding SJA1105_SPEED_INVALID = -EINVAL which feels hackish. Andrew