mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
[NET]: kfree cleanup
From: Jesper Juhl <jesper.juhl@gmail.com> This is the net/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in net/. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Arnaldo Carvalho de Melo <acme@conectiva.com.br> Acked-by: Marcel Holtmann <marcel@holtmann.org> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Andrew Morton <akpm@osdl.org>
This commit is contained in:
parent
ac7c98eca8
commit
a51482bde2
47 changed files with 99 additions and 191 deletions
|
@ -1099,7 +1099,7 @@ static void release_driver(struct sock *sk)
|
|||
sock_reset_flag(sk, SOCK_ZAPPED);
|
||||
wp = wp_sk(sk);
|
||||
|
||||
if (wp && wp->mbox) {
|
||||
if (wp) {
|
||||
kfree(wp->mbox);
|
||||
wp->mbox = NULL;
|
||||
}
|
||||
|
@ -1186,10 +1186,8 @@ static void wanpipe_kill_sock_timer (unsigned long data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (wp_sk(sk)) {
|
||||
kfree(wp_sk(sk));
|
||||
wp_sk(sk) = NULL;
|
||||
}
|
||||
kfree(wp_sk(sk));
|
||||
wp_sk(sk) = NULL;
|
||||
|
||||
if (atomic_read(&sk->sk_refcnt) != 1) {
|
||||
atomic_set(&sk->sk_refcnt, 1);
|
||||
|
@ -1219,10 +1217,8 @@ static void wanpipe_kill_sock_accept (struct sock *sk)
|
|||
sk->sk_socket = NULL;
|
||||
|
||||
|
||||
if (wp_sk(sk)) {
|
||||
kfree(wp_sk(sk));
|
||||
wp_sk(sk) = NULL;
|
||||
}
|
||||
kfree(wp_sk(sk));
|
||||
wp_sk(sk) = NULL;
|
||||
|
||||
if (atomic_read(&sk->sk_refcnt) != 1) {
|
||||
atomic_set(&sk->sk_refcnt, 1);
|
||||
|
@ -1243,10 +1239,8 @@ static void wanpipe_kill_sock_irq (struct sock *sk)
|
|||
|
||||
sk->sk_socket = NULL;
|
||||
|
||||
if (wp_sk(sk)) {
|
||||
kfree(wp_sk(sk));
|
||||
wp_sk(sk) = NULL;
|
||||
}
|
||||
kfree(wp_sk(sk));
|
||||
wp_sk(sk) = NULL;
|
||||
|
||||
if (atomic_read(&sk->sk_refcnt) != 1) {
|
||||
atomic_set(&sk->sk_refcnt, 1);
|
||||
|
|
|
@ -714,10 +714,8 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
|
|||
}
|
||||
|
||||
/* This code has moved from del_if() function */
|
||||
if (dev->priv) {
|
||||
kfree(dev->priv);
|
||||
dev->priv = NULL;
|
||||
}
|
||||
kfree(dev->priv);
|
||||
dev->priv = NULL;
|
||||
|
||||
#ifdef CONFIG_WANPIPE_MULTPPP
|
||||
if (cnf->config_id == WANCONFIG_MPPP)
|
||||
|
@ -851,10 +849,8 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
|
|||
|
||||
/* Due to new interface linking method using dev->priv,
|
||||
* this code has moved from del_if() function.*/
|
||||
if (dev->priv){
|
||||
kfree(dev->priv);
|
||||
dev->priv=NULL;
|
||||
}
|
||||
kfree(dev->priv);
|
||||
dev->priv=NULL;
|
||||
|
||||
unregister_netdev(dev);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue