dsa: do not dereference non-existing routing table
authorTobias Waldekranz <tobias@waldekranz.com>
Thu, 5 Feb 2015 13:52:06 +0000 (14:52 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Feb 2015 06:07:36 +0000 (22:07 -0800)
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>
drivers/net/dsa/mv88e6131.c

index 1230f52aa70e8c4d31e8be1d397f59eab9c4b7eb..2540ef0142afd68f5dfb489850bbd9ad64f3fdc2 100644 (file)
@@ -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);
This page took 0.024758 seconds and 5 git commands to generate.