aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-11-08 12:41:34 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-08 12:41:34 -0500
commita51482bde22f99c63fbbb57d5d46cc666384e379 (patch)
tree5482ed1c0803edb2ffbd51035de921fb0f72d82b /net/ax25
parentac7c98eca88a854755475fcfe1b2bf5f97f90d99 (diff)
[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 8e37e71e34ff..1b683f302657 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,
1138 sk->sk_state = TCP_CLOSE; 1138 sk->sk_state = TCP_CLOSE;
1139 sock->state = SS_UNCONNECTED; 1139 sock->state = SS_UNCONNECTED;
1140 1140
1141 if (ax25->digipeat != NULL) { 1141 kfree(ax25->digipeat);
1142 kfree(ax25->digipeat); 1142 ax25->digipeat = NULL;
1143 ax25->digipeat = NULL;
1144 }
1145 1143
1146 /* 1144 /*
1147 * Handle digi-peaters to be used. 1145 * Handle digi-peaters to be used.
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 73cfc3411c46..4cf87540fb3a 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,
401 } 401 }
402 402
403 if (dp.ndigi == 0) { 403 if (dp.ndigi == 0) {
404 if (ax25->digipeat != NULL) { 404 kfree(ax25->digipeat);
405 kfree(ax25->digipeat); 405 ax25->digipeat = NULL;
406 ax25->digipeat = NULL;
407 }
408 } else { 406 } else {
409 /* Reverse the source SABM's path */ 407 /* Reverse the source SABM's path */
410 memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi)); 408 memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi));
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 26b77d972220..b1e945bd6ed3 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)
54 if (s->dev == dev) { 54 if (s->dev == dev) {
55 if (ax25_route_list == s) { 55 if (ax25_route_list == s) {
56 ax25_route_list = s->next; 56 ax25_route_list = s->next;
57 if (s->digipeat != NULL) 57 kfree(s->digipeat);
58 kfree(s->digipeat);
59 kfree(s); 58 kfree(s);
60 } else { 59 } else {
61 for (t = ax25_route_list; t != NULL; t = t->next) { 60 for (t = ax25_route_list; t != NULL; t = t->next) {
62 if (t->next == s) { 61 if (t->next == s) {
63 t->next = s->next; 62 t->next = s->next;
64 if (s->digipeat != NULL) 63 kfree(s->digipeat);
65 kfree(s->digipeat);
66 kfree(s); 64 kfree(s);
67 break; 65 break;
68 } 66 }
@@ -90,10 +88,8 @@ static int ax25_rt_add(struct ax25_routes_struct *route)
90 while (ax25_rt != NULL) { 88 while (ax25_rt != NULL) {
91 if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 && 89 if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 &&
92 ax25_rt->dev == ax25_dev->dev) { 90 ax25_rt->dev == ax25_dev->dev) {
93 if (ax25_rt->digipeat != NULL) { 91 kfree(ax25_rt->digipeat);
94 kfree(ax25_rt->digipeat); 92 ax25_rt->digipeat = NULL;
95 ax25_rt->digipeat = NULL;
96 }
97 if (route->digi_count != 0) { 93 if (route->digi_count != 0) {
98 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { 94 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
99 write_unlock(&ax25_route_lock); 95 write_unlock(&ax25_route_lock);
@@ -145,8 +141,7 @@ static int ax25_rt_add(struct ax25_routes_struct *route)
145static void ax25_rt_destroy(ax25_route *ax25_rt) 141static void ax25_rt_destroy(ax25_route *ax25_rt)
146{ 142{
147 if (atomic_read(&ax25_rt->ref) == 0) { 143 if (atomic_read(&ax25_rt->ref) == 0) {
148 if (ax25_rt->digipeat != NULL) 144 kfree(ax25_rt->digipeat);
149 kfree(ax25_rt->digipeat);
150 kfree(ax25_rt); 145 kfree(ax25_rt);
151 return; 146 return;
152 } 147 }
@@ -530,9 +525,7 @@ void __exit ax25_rt_free(void)
530 s = ax25_rt; 525 s = ax25_rt;
531 ax25_rt = ax25_rt->next; 526 ax25_rt = ax25_rt->next;
532 527
533 if (s->digipeat != NULL) 528 kfree(s->digipeat);
534 kfree(s->digipeat);
535
536 kfree(s); 529 kfree(s);
537 } 530 }
538 write_unlock(&ax25_route_lock); 531 write_unlock(&ax25_route_lock);