diff options
author | Julia Lawall <julia@diku.dk> | 2011-07-27 22:46:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-01 05:27:21 -0400 |
commit | 956837f7c954443f426a82ba6f17b33488cf9a0c (patch) | |
tree | 60bb37151459871331c355e358f4f9dcd38ef03b /drivers/net/niu.c | |
parent | a1889c0d2039a53ae04abb9f20c62500bd312bf3 (diff) |
drivers/net/niu.c: adjust array index
Convert array index from the loop bound to the loop index.
A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e1,e2,ar;
@@
for(e1 = 0; e1 < e2; e1++) { <...
ar[
- e2
+ e1
]
...> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r-- | drivers/net/niu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index cd6c2317e29e..ed47585a6862 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -9201,7 +9201,7 @@ static int __devinit niu_ldg_init(struct niu *np) | |||
9201 | 9201 | ||
9202 | first_chan = 0; | 9202 | first_chan = 0; |
9203 | for (i = 0; i < port; i++) | 9203 | for (i = 0; i < port; i++) |
9204 | first_chan += parent->rxchan_per_port[port]; | 9204 | first_chan += parent->rxchan_per_port[i]; |
9205 | num_chan = parent->rxchan_per_port[port]; | 9205 | num_chan = parent->rxchan_per_port[port]; |
9206 | 9206 | ||
9207 | for (i = first_chan; i < (first_chan + num_chan); i++) { | 9207 | for (i = first_chan; i < (first_chan + num_chan); i++) { |
@@ -9217,7 +9217,7 @@ static int __devinit niu_ldg_init(struct niu *np) | |||
9217 | 9217 | ||
9218 | first_chan = 0; | 9218 | first_chan = 0; |
9219 | for (i = 0; i < port; i++) | 9219 | for (i = 0; i < port; i++) |
9220 | first_chan += parent->txchan_per_port[port]; | 9220 | first_chan += parent->txchan_per_port[i]; |
9221 | num_chan = parent->txchan_per_port[port]; | 9221 | num_chan = parent->txchan_per_port[port]; |
9222 | for (i = first_chan; i < (first_chan + num_chan); i++) { | 9222 | for (i = first_chan; i < (first_chan + num_chan); i++) { |
9223 | err = niu_ldg_assign_ldn(np, parent, | 9223 | err = niu_ldg_assign_ldn(np, parent, |