]> git.baikalelectronics.ru Git - kernel.git/commit
drivers: net: cpsw: Fix broken loop condition in switch mode
authorLennart Sorensen <lsorense@csclub.uwaterloo.ca>
Fri, 31 Oct 2014 17:28:54 +0000 (13:28 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Oct 2014 20:16:42 +0000 (16:16 -0400)
commiteec486ee9f09a72a4df38f376f31d52272abc15b
treed35fd25f0fdce665a75d7b6134172b0d097ae3dd
parent8caf959e351837b41d5c3a03cff5db38d665f0a9
drivers: net: cpsw: Fix broken loop condition in switch mode

a87ca6ae8bb3616fe9f11b768bfbd794dc6d38ab (drivers: net: cpsw: fix buggy
loop condition) accidentally fixed a loop comparison in too many places
while fixing a real bug.

It was correct to fix the dual_emac mode section since there 'i' is used
as an index into priv->slaves which is a 0 based array.

However the other two changes (which are only used in switch mode)
are wrong since there 'i' is actually the ALE port number, and port 0
is the host port, while port 1 and up are the slave ports.

Putting the loop condition back in the switch mode section fixes it.

A comment has been added to point out the intent clearly to avoid future
confusion.  Also a comment is fixed that said the opposite of what was
actually happening.

Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Acked-by: Heiko Schocher <hs@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c