]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: sja1105: fix check on while loop exit
authorColin Ian King <colin.king@canonical.com>
Wed, 8 May 2019 13:30:41 +0000 (14:30 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 May 2019 20:13:25 +0000 (13:13 -0700)
commit5b8cfa068ed61625001f91e2c0138c9f6fd8e8f7
treef13ab349b614a4930789b83cd23ec03e0f0f13d1
parent1f80a02c5993c8431a176a54a2487afff028b570
net: dsa: sja1105: fix check on while loop exit

The while-loop exit condition check is not correct; the
loop should continue if the returns from the function calls are
negative or the CRC status returns are invalid.  Currently it
is ignoring the returns from the function calls.  Fix this by
removing the status return checks and only break from the loop
at the very end when we know that all the success condtions have
been met.

Kudos to Dan Carpenter for describing the correct fix and
Vladimir Oltean for noting the change to the check on the number
of retries.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 6772132ada66 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_spi.c