diff options
author | Tobias Waldekranz <tobias@waldekranz.com> | 2015-02-05 08:52:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-08 01:07:36 -0500 |
commit | 6e0ba47f9191511a91556b7ca2c491362680a0f3 (patch) | |
tree | 056bfafda797d81c2240e272e433efc194dae587 /drivers/net/dsa/mv88e6131.c | |
parent | 11b1f8288d4341af5d755281c871bff6c3e270dd (diff) |
dsa: do not dereference non-existing routing table
In the case where there is only one switch, no routing table will have
been allocated, so do not dereference it in this case.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6131.c')
-rw-r--r-- | drivers/net/dsa/mv88e6131.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c index 1230f52aa70e..2540ef0142af 100644 --- a/drivers/net/dsa/mv88e6131.c +++ b/drivers/net/dsa/mv88e6131.c | |||
@@ -139,7 +139,8 @@ static int mv88e6131_setup_global(struct dsa_switch *ds) | |||
139 | int nexthop; | 139 | int nexthop; |
140 | 140 | ||
141 | nexthop = 0x1f; | 141 | nexthop = 0x1f; |
142 | if (i != ds->index && i < ds->dst->pd->nr_chips) | 142 | if (ds->pd->rtable && |
143 | i != ds->index && i < ds->dst->pd->nr_chips) | ||
143 | nexthop = ds->pd->rtable[i] & 0x1f; | 144 | nexthop = ds->pd->rtable[i] & 0x1f; |
144 | 145 | ||
145 | REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop); | 146 | REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop); |