net: use the new API kvfree()
authorWANG Cong <xiyou.wangcong@gmail.com>
Mon, 2 Jun 2014 22:55:22 +0000 (15:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Jun 2014 07:49:51 +0000 (00:49 -0700)
It is available since v3.15-rc5.

Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c
net/ipv4/tcp_metrics.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/nft_hash.c
net/netfilter/xt_recent.c
net/sched/sch_choke.c
net/sched/sch_fq.c
net/sched/sch_fq_codel.c
net/sched/sch_hhf.c
net/sched/sch_netem.c
net/sched/sch_sfq.c

index 5367bfba094781bc74f7e67853e96d4105948534..a9a08e4a4857fd996b9b93c6070987e3b01a64f5 100644 (file)
@@ -5933,10 +5933,7 @@ static void netdev_init_one_queue(struct net_device *dev,
 
 static void netif_free_tx_queues(struct net_device *dev)
 {
-       if (is_vmalloc_addr(dev->_tx))
-               vfree(dev->_tx);
-       else
-               kfree(dev->_tx);
+       kvfree(dev->_tx);
 }
 
 static int netif_alloc_netdev_queues(struct net_device *dev)
@@ -6410,10 +6407,7 @@ void netdev_freemem(struct net_device *dev)
 {
        char *addr = (char *)dev - dev->padded;
 
-       if (is_vmalloc_addr(addr))
-               vfree(addr);
-       else
-               kfree(addr);
+       kvfree(addr);
 }
 
 /**
index dcaf72f10216c22f00ef918963d260d4ce472b99..4fe04180598969e653a01db2c459edd2c8d8acce 100644 (file)
@@ -1159,10 +1159,7 @@ static void __net_exit tcp_net_metrics_exit(struct net *net)
                        tm = next;
                }
        }
-       if (is_vmalloc_addr(net->ipv4.tcp_metrics_hash))
-               vfree(net->ipv4.tcp_metrics_hash);
-       else
-               kfree(net->ipv4.tcp_metrics_hash);
+       kvfree(net->ipv4.tcp_metrics_hash);
 }
 
 static __net_initdata struct pernet_operations tcp_net_metrics_ops = {
index 117208321f16997af9f24bee1f86519f8f8fa26e..ec8114fae50b297f56760c3ac22d378c31957cd4 100644 (file)
@@ -271,10 +271,7 @@ ip_set_free(void *members)
 {
        pr_debug("%p: free with %s\n", members,
                 is_vmalloc_addr(members) ? "vfree" : "kfree");
-       if (is_vmalloc_addr(members))
-               vfree(members);
-       else
-               kfree(members);
+       kvfree(members);
 }
 EXPORT_SYMBOL_GPL(ip_set_free);
 
index 1dfeb6786832e83670968f577672e364baa7f039..4080ed6a072bf7c4bb414e19a38f9a663557198a 100644 (file)
@@ -76,10 +76,7 @@ static bool nft_hash_lookup(const struct nft_set *set,
 
 static void nft_hash_tbl_free(const struct nft_hash_table *tbl)
 {
-       if (is_vmalloc_addr(tbl))
-               vfree(tbl);
-       else
-               kfree(tbl);
+       kvfree(tbl);
 }
 
 static unsigned int nft_hash_tbl_size(unsigned int nelem)
index 1e657cf715c478d9a9ec77411bf7536b14278d14..a9faae89f95533a53da4651efb2f737e3a0952b4 100644 (file)
@@ -313,10 +313,7 @@ out:
 
 static void recent_table_free(void *addr)
 {
-       if (is_vmalloc_addr(addr))
-               vfree(addr);
-       else
-               kfree(addr);
+       kvfree(addr);
 }
 
 static int recent_mt_check(const struct xt_mtchk_param *par,
index 2aee02802c2760fafabb47d6bf4229d08d8ef907..ed30e436128bff7c556e0c334e4cb5ae8d088e5e 100644 (file)
@@ -391,12 +391,7 @@ static const struct nla_policy choke_policy[TCA_CHOKE_MAX + 1] = {
 
 static void choke_free(void *addr)
 {
-       if (addr) {
-               if (is_vmalloc_addr(addr))
-                       vfree(addr);
-               else
-                       kfree(addr);
-       }
+       kvfree(addr);
 }
 
 static int choke_change(struct Qdisc *sch, struct nlattr *opt)
index 23c682b42f99ecb86ca8a103005a52d692a21d38..ba32c2b005d0821788f656e8ae05d4d47a862351 100644 (file)
@@ -591,10 +591,7 @@ static void *fq_alloc_node(size_t sz, int node)
 
 static void fq_free(void *addr)
 {
-       if (addr && is_vmalloc_addr(addr))
-               vfree(addr);
-       else
-               kfree(addr);
+       kvfree(addr);
 }
 
 static int fq_resize(struct Qdisc *sch, u32 log)
index 0bf432c782c1f17cdb8bbb1b8ece16848e63c27e..063b726bf1f8636e3529a2e61d1b43fced918d9c 100644 (file)
@@ -365,12 +365,7 @@ static void *fq_codel_zalloc(size_t sz)
 
 static void fq_codel_free(void *addr)
 {
-       if (addr) {
-               if (is_vmalloc_addr(addr))
-                       vfree(addr);
-               else
-                       kfree(addr);
-       }
+       kvfree(addr);
 }
 
 static void fq_codel_destroy(struct Qdisc *sch)
index 6aab8619bbb002570d206d9ff6bb9c90eb82261a..d85b6812a7d4c6bd0794decd872406e6b810e779 100644 (file)
@@ -494,12 +494,7 @@ static void *hhf_zalloc(size_t sz)
 
 static void hhf_free(void *addr)
 {
-       if (addr) {
-               if (is_vmalloc_addr(addr))
-                       vfree(addr);
-               else
-                       kfree(addr);
-       }
+       kvfree(addr);
 }
 
 static void hhf_destroy(struct Qdisc *sch)
index f1669a00f5710c297310f4a1da4a1b4e72cd3cab..111d70fddaea97242ac4a85115e969efcd11dfcd 100644 (file)
@@ -648,12 +648,7 @@ static void netem_reset(struct Qdisc *sch)
 
 static void dist_free(struct disttable *d)
 {
-       if (d) {
-               if (is_vmalloc_addr(d))
-                       vfree(d);
-               else
-                       kfree(d);
-       }
+       kvfree(d);
 }
 
 /*
index 87317ff0b4ec4699dae7898405666d2bde6c9897..1af2f73906d07aa5bf6f428ffe37b81523178ee4 100644 (file)
@@ -716,12 +716,7 @@ static void *sfq_alloc(size_t sz)
 
 static void sfq_free(void *addr)
 {
-       if (addr) {
-               if (is_vmalloc_addr(addr))
-                       vfree(addr);
-               else
-                       kfree(addr);
-       }
+       kvfree(addr);
 }
 
 static void sfq_destroy(struct Qdisc *sch)