aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-06-04 15:16:59 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-04 17:29:53 -0400
commit4a7704ffa86705b0580b6473c407b7b7618e072d (patch)
treeea9483934d983ffb5f00c22f9b1aa6b881b6b71c /net/dsa
parent189b0d93ec61e1f991e96d7bc03b03cf929d164c (diff)
net: dsa: Remove dynamic allocate of routing table
With a maximum of four switches, the size of the routing table is the same as the pointer to it. Removing it makes the code simpler. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/dsa.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 5907f8cd13b6..6177dd750847 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -587,17 +587,6 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
587 if (link_sw_addr >= pd->nr_chips) 587 if (link_sw_addr >= pd->nr_chips)
588 return -EINVAL; 588 return -EINVAL;
589 589
590 /* First time routing table allocation */
591 if (!cd->rtable) {
592 cd->rtable = kmalloc_array(pd->nr_chips, sizeof(s8),
593 GFP_KERNEL);
594 if (!cd->rtable)
595 return -ENOMEM;
596
597 /* default to no valid uplink/downlink */
598 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8));
599 }
600
601 cd->rtable[link_sw_addr] = port_index; 590 cd->rtable[link_sw_addr] = port_index;
602 591
603 return 0; 592 return 0;
@@ -639,7 +628,6 @@ static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
639 kfree(pd->chip[i].port_names[port_index]); 628 kfree(pd->chip[i].port_names[port_index]);
640 port_index++; 629 port_index++;
641 } 630 }
642 kfree(pd->chip[i].rtable);
643 631
644 /* Drop our reference to the MDIO bus device */ 632 /* Drop our reference to the MDIO bus device */
645 if (pd->chip[i].host_dev) 633 if (pd->chip[i].host_dev)