summaryrefslogtreecommitdiff
path: root/net/ax25
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-11-08 09:41:34 -0800
committerDavid S. Miller <davem@davemloft.net>2005-11-08 09:41:34 -0800
commita51482bde22f99c63fbbb57d5d46cc666384e379 (patch)
tree5482ed1c0803edb2ffbd51035de921fb0f72d82b /net/ax25
parentac7c98eca88a854755475fcfe1b2bf5f97f90d99 (diff)
downloadlinux-3.10-a51482bde22f99c63fbbb57d5d46cc666384e379.tar.gz
linux-3.10-a51482bde22f99c63fbbb57d5d46cc666384e379.tar.bz2
linux-3.10-a51482bde22f99c63fbbb57d5d46cc666384e379.zip
[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>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/af_ax25.c6
-rw-r--r--net/ax25/ax25_in.c6
-rw-r--r--net/ax25/ax25_route.c19
3 files changed, 10 insertions, 21 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8e37e71e34f..1b683f30265 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1138,10 +1138,8 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr,
sk->sk_state = TCP_CLOSE;
sock->state = SS_UNCONNECTED;
- if (ax25->digipeat != NULL) {
- kfree(ax25->digipeat);
- ax25->digipeat = NULL;
- }
+ kfree(ax25->digipeat);
+ ax25->digipeat = NULL;
/*
* Handle digi-peaters to be used.
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 73cfc3411c4..4cf87540fb3 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -401,10 +401,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
}
if (dp.ndigi == 0) {
- if (ax25->digipeat != NULL) {
- kfree(ax25->digipeat);
- ax25->digipeat = NULL;
- }
+ kfree(ax25->digipeat);
+ ax25->digipeat = NULL;
} else {
/* Reverse the source SABM's path */
memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi));
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 26b77d97222..b1e945bd6ed 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -54,15 +54,13 @@ void ax25_rt_device_down(struct net_device *dev)
if (s->dev == dev) {
if (ax25_route_list == s) {
ax25_route_list = s->next;
- if (s->digipeat != NULL)
- kfree(s->digipeat);
+ kfree(s->digipeat);
kfree(s);
} else {
for (t = ax25_route_list; t != NULL; t = t->next) {
if (t->next == s) {
t->next = s->next;
- if (s->digipeat != NULL)
- kfree(s->digipeat);
+ kfree(s->digipeat);
kfree(s);
break;
}
@@ -90,10 +88,8 @@ static int ax25_rt_add(struct ax25_routes_struct *route)
while (ax25_rt != NULL) {
if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 &&
ax25_rt->dev == ax25_dev->dev) {
- if (ax25_rt->digipeat != NULL) {
- kfree(ax25_rt->digipeat);
- ax25_rt->digipeat = NULL;
- }
+ kfree(ax25_rt->digipeat);
+ ax25_rt->digipeat = NULL;
if (route->digi_count != 0) {
if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
write_unlock(&ax25_route_lock);
@@ -145,8 +141,7 @@ static int ax25_rt_add(struct ax25_routes_struct *route)
static void ax25_rt_destroy(ax25_route *ax25_rt)
{
if (atomic_read(&ax25_rt->ref) == 0) {
- if (ax25_rt->digipeat != NULL)
- kfree(ax25_rt->digipeat);
+ kfree(ax25_rt->digipeat);
kfree(ax25_rt);
return;
}
@@ -530,9 +525,7 @@ void __exit ax25_rt_free(void)
s = ax25_rt;
ax25_rt = ax25_rt->next;
- if (s->digipeat != NULL)
- kfree(s->digipeat);
-
+ kfree(s->digipeat);
kfree(s);
}
write_unlock(&ax25_route_lock);