diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/dsa.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index aa2ff583b7ed..0eb5d5e76dfb 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -350,9 +350,11 @@ static void dsa_of_free_platform_data(struct dsa_platform_data *pd) | |||
350 | 350 | ||
351 | for (i = 0; i < pd->nr_chips; i++) { | 351 | for (i = 0; i < pd->nr_chips; i++) { |
352 | port_index = 0; | 352 | port_index = 0; |
353 | while (pd->chip[i].port_names && | 353 | while (port_index < DSA_MAX_PORTS) { |
354 | pd->chip[i].port_names[++port_index]) | 354 | if (pd->chip[i].port_names[port_index]) |
355 | kfree(pd->chip[i].port_names[port_index]); | 355 | kfree(pd->chip[i].port_names[port_index]); |
356 | port_index++; | ||
357 | } | ||
356 | kfree(pd->chip[i].rtable); | 358 | kfree(pd->chip[i].rtable); |
357 | } | 359 | } |
358 | kfree(pd->chip); | 360 | kfree(pd->chip); |