summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Waldekranz <tobias@waldekranz.com>2015-02-05 14:52:06 +0100
committerDavid S. Miller <davem@davemloft.net>2015-02-07 22:07:36 -0800
commit6e0ba47f9191511a91556b7ca2c491362680a0f3 (patch)
tree056bfafda797d81c2240e272e433efc194dae587
parent11b1f8288d4341af5d755281c871bff6c3e270dd (diff)
downloadop-kernel-dev-6e0ba47f9191511a91556b7ca2c491362680a0f3.zip
op-kernel-dev-6e0ba47f9191511a91556b7ca2c491362680a0f3.tar.gz
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>
-rw-r--r--drivers/net/dsa/mv88e6131.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 1230f52..2540ef0 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)
int nexthop;
nexthop = 0x1f;
- if (i != ds->index && i < ds->dst->pd->nr_chips)
+ if (ds->pd->rtable &&
+ i != ds->index && i < ds->dst->pd->nr_chips)
nexthop = ds->pd->rtable[i] & 0x1f;
REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop);
OpenPOWER on IntegriCloud