cxgb4: fix memory leak
authorGanesh Goudar <ganeshgr@chelsio.com>
Mon, 4 Sep 2017 05:46:28 +0000 (11:16 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Sep 2017 21:27:50 +0000 (14:27 -0700)
do not reuse the loop counter which is used iterate over
the ports, so that sched_tbl will be freed for all the ports.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/sched.c

index 02acff741f114602c3676dad846d714d0f23a99d..9148abb7994c8d9d91a75c01c286daa36ce9cd1b 100644 (file)
@@ -533,10 +533,10 @@ struct sched_table *t4_init_sched(unsigned int sched_size)
 void t4_cleanup_sched(struct adapter *adap)
 {
        struct sched_table *s;
-       unsigned int i;
+       unsigned int j, i;
 
-       for_each_port(adap, i) {
-               struct port_info *pi = netdev2pinfo(adap->port[i]);
+       for_each_port(adap, j) {
+               struct port_info *pi = netdev2pinfo(adap->port[j]);
 
                s = pi->sched_tbl;
                for (i = 0; i < s->sched_size; i++) {