[NET]: kfree cleanup
authorJesper Juhl <jesper.juhl@gmail.com>
Tue, 8 Nov 2005 17:41:34 +0000 (09:41 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Nov 2005 17:41:34 +0000 (09:41 -0800)
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>
47 files changed:
net/802/p8023.c
net/ax25/af_ax25.c
net/ax25/ax25_in.c
net/ax25/ax25_route.c
net/bluetooth/hidp/core.c
net/core/dev_mcast.c
net/core/sock.c
net/dccp/ipv4.c
net/dccp/proto.c
net/decnet/dn_table.c
net/ethernet/pe2.c
net/ipv4/af_inet.c
net/ipv4/fib_frontend.c
net/ipv4/ip_options.c
net/ipv4/ip_output.c
net/ipv4/ip_sockglue.c
net/ipv4/ipvs/ip_vs_app.c
net/ipv4/multipath_wrandom.c
net/ipv4/netfilter/ip_nat_snmp_basic.c
net/ipv4/tcp_ipv4.c
net/ipv6/addrconf.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/ipv6/ipcomp6.c
net/ipv6/ipv6_sockglue.c
net/irda/discovery.c
net/irda/irias_object.c
net/rose/rose_route.c
net/sched/cls_fw.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c
net/sched/em_meta.c
net/sctp/associola.c
net/sctp/sm_make_chunk.c
net/sunrpc/auth_gss/gss_krb5_seal.c
net/sunrpc/auth_gss/gss_krb5_unseal.c
net/sunrpc/auth_gss/gss_mech_switch.c
net/sunrpc/auth_gss/gss_spkm3_seal.c
net/sunrpc/auth_gss/gss_spkm3_token.c
net/sunrpc/auth_gss/gss_spkm3_unseal.c
net/sunrpc/svc.c
net/sunrpc/xdr.c
net/wanrouter/af_wanpipe.c
net/wanrouter/wanmain.c
net/xfrm/xfrm_state.c

index 6368d3dce444489ea41e654067aa92c012c0b924..d23e906456eb373ccbbd5ead89270ff198ceaf2e 100644 (file)
@@ -54,8 +54,7 @@ struct datalink_proto *make_8023_client(void)
  */
 void destroy_8023_client(struct datalink_proto *dl)
 {
-       if (dl)
-               kfree(dl);
+       kfree(dl);
 }
 
 EXPORT_SYMBOL(destroy_8023_client);
index 8e37e71e34ff1929aef5a8b8efb2ef362dec6b54..1b683f302657d376f438b8f9ea68805bdd14118c 100644 (file)
@@ -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.
index 73cfc3411c461d50d7dbb7d718dd3e2315d26428..4cf87540fb3abd79df222319a9c79e3dc09f2e3d 100644 (file)
@@ -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));
index 26b77d9722201232d7adfcb2bb27dcc3fb90e246..b1e945bd6ed3d0f22e1a306303ad32ca4a471cc6 100644 (file)
@@ -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);
index 860444a7fc0f8e1e014f063721ecdc221a365304..cdb9cfafd960b5c45730b933f0515e1b79f1bfd4 100644 (file)
@@ -660,9 +660,7 @@ unlink:
 failed:
        up_write(&hidp_session_sem);
 
-       if (session->input)
-               kfree(session->input);
-
+       kfree(session->input);
        kfree(session);
        return err;
 }
index db098ff3cd6a7509b58cec0b45da50e6cf76673e..cb530eef0e3990f2f3fce1076b2660b5109555b7 100644 (file)
@@ -194,8 +194,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
 
 done:
        spin_unlock_bh(&dev->xmit_lock);
-       if (dmi1)
-               kfree(dmi1);
+       kfree(dmi1);
        return err;
 }
 
index 9602ceb3bac9a2d33eec5ce1bc0cb8a55340203b..13cc3be4f056fb92f86cd660b6dcd29ba88ed30d 100644 (file)
@@ -1242,8 +1242,7 @@ static void sock_def_write_space(struct sock *sk)
 
 static void sock_def_destruct(struct sock *sk)
 {
-       if (sk->sk_protinfo)
-               kfree(sk->sk_protinfo);
+       kfree(sk->sk_protinfo);
 }
 
 void sk_send_sigurg(struct sock *sk)
index 4b9bc81ae1a3a35c6fe91a1c4cea05678c2e0781..ca03521112c52bfa4e279b351aee54c980105e71 100644 (file)
@@ -1263,10 +1263,8 @@ static int dccp_v4_destroy_sock(struct sock *sk)
        if (inet_csk(sk)->icsk_bind_hash != NULL)
                inet_put_port(&dccp_hashinfo, sk);
 
-       if (dp->dccps_service_list != NULL) {
-               kfree(dp->dccps_service_list);
-               dp->dccps_service_list = NULL;
-       }
+       kfree(dp->dccps_service_list);
+       dp->dccps_service_list = NULL;
 
        ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk);
        ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk);
index a021c3422f6773d3d5643e9b7e9ccdc475511951..e0ace7cbb9960cc5d145304b7ce8bf8a8a5de2a2 100644 (file)
@@ -238,8 +238,7 @@ static int dccp_setsockopt_service(struct sock *sk, const u32 service,
        lock_sock(sk);
        dp->dccps_service = service;
 
-       if (dp->dccps_service_list != NULL)
-               kfree(dp->dccps_service_list);
+       kfree(dp->dccps_service_list);
 
        dp->dccps_service_list = sl;
        release_sock(sk);
index eeba56f99323b0cf82131b0fa3f6c9614dc2927e..6f8b5658cb4e9caf0c9d84438f02dcdd37348b66 100644 (file)
@@ -784,16 +784,14 @@ struct dn_fib_table *dn_fib_get_table(int n, int create)
 
 static void dn_fib_del_tree(int n)
 {
-        struct dn_fib_table *t;
+       struct dn_fib_table *t;
 
-        write_lock(&dn_fib_tables_lock);
-        t = dn_fib_tables[n];
-        dn_fib_tables[n] = NULL;
-        write_unlock(&dn_fib_tables_lock);
+       write_lock(&dn_fib_tables_lock);
+       t = dn_fib_tables[n];
+       dn_fib_tables[n] = NULL;
+       write_unlock(&dn_fib_tables_lock);
 
-        if (t) {
-                kfree(t);
-        }
+       kfree(t);
 }
 
 struct dn_fib_table *dn_fib_empty_table(void)
index 98a494be6039452700e39a227fcf7a23d69ab3f6..9d57b4fb6440c74532856b9fc4160821aa19d2b8 100644 (file)
@@ -32,8 +32,7 @@ struct datalink_proto *make_EII_client(void)
 
 void destroy_EII_client(struct datalink_proto *dl)
 {
-       if (dl)
-               kfree(dl);
+       kfree(dl);
 }
 
 EXPORT_SYMBOL(destroy_EII_client);
index a9d84f93442c9560a8e7050a60292876b09bd508..eaa150c33b0403204fa22224d6434e5c45f7695c 100644 (file)
@@ -147,8 +147,7 @@ void inet_sock_destruct(struct sock *sk)
        BUG_TRAP(!sk->sk_wmem_queued);
        BUG_TRAP(!sk->sk_forward_alloc);
 
-       if (inet->opt)
-               kfree(inet->opt);
+       kfree(inet->opt);
        dst_release(sk->sk_dst_cache);
        sk_refcnt_debug_dec(sk);
 }
index 990633c09dfe4ccdf345d06281880117b57c7906..2267c1fad879f6d047d86a52d572b270d3af5af0 100644 (file)
@@ -266,8 +266,7 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
                                if (tb)
                                        err = tb->tb_insert(tb, &req.rtm, &rta, &req.nlh, NULL);
                        }
-                       if (rta.rta_mx)
-                               kfree(rta.rta_mx);
+                       kfree(rta.rta_mx);
                }
                rtnl_unlock();
                return err;
index bce4e875193be1d596c4c607ab42e9e1f966513f..dbe12da8d8b3960fe7dc796de97eae2546e1528d 100644 (file)
@@ -510,8 +510,7 @@ static int ip_options_get_finish(struct ip_options **optp,
                kfree(opt);
                return -EINVAL;
        }
-       if (*optp)
-               kfree(*optp);
+       kfree(*optp);
        *optp = opt;
        return 0;
 }
index 17758234a3e351e4787824bf1e1cda3dc72dfded..df7f20da422d95e950fc79262440b5c59034c2dd 100644 (file)
@@ -1262,10 +1262,8 @@ int ip_push_pending_frames(struct sock *sk)
 
 out:
        inet->cork.flags &= ~IPCORK_OPT;
-       if (inet->cork.opt) {
-               kfree(inet->cork.opt);
-               inet->cork.opt = NULL;
-       }
+       kfree(inet->cork.opt);
+       inet->cork.opt = NULL;
        if (inet->cork.rt) {
                ip_rt_put(inet->cork.rt);
                inet->cork.rt = NULL;
@@ -1289,10 +1287,8 @@ void ip_flush_pending_frames(struct sock *sk)
                kfree_skb(skb);
 
        inet->cork.flags &= ~IPCORK_OPT;
-       if (inet->cork.opt) {
-               kfree(inet->cork.opt);
-               inet->cork.opt = NULL;
-       }
+       kfree(inet->cork.opt);
+       inet->cork.opt = NULL;
        if (inet->cork.rt) {
                ip_rt_put(inet->cork.rt);
                inet->cork.rt = NULL;
index 2f0b47da5b37e3b3c0c44235355e704958cba8a3..4f2d8725730958f498b3d319c9e3dca68cd50722 100644 (file)
@@ -202,8 +202,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s
                if (ra->sk == sk) {
                        if (on) {
                                write_unlock_bh(&ip_ra_lock);
-                               if (new_ra)
-                                       kfree(new_ra);
+                               kfree(new_ra);
                                return -EADDRINUSE;
                        }
                        *rap = ra->next;
@@ -446,8 +445,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
 #endif
                        }
                        opt = xchg(&inet->opt, opt);
-                       if (opt)
-                               kfree(opt);
+                       kfree(opt);
                        break;
                }
                case IP_PKTINFO:
@@ -828,10 +826,8 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
 
                        err = ip_mc_msfilter(sk, msf, ifindex);
 mc_msf_out:
-                       if (msf)
-                               kfree(msf);
-                       if (gsf)
-                               kfree(gsf);
+                       kfree(msf);
+                       kfree(gsf);
                        break;
                }
                case IP_ROUTER_ALERT:   
index fc6f95aaa96976e27c14d733e09f03888ea31592..d7eb680101c25311233b9195faedca1aa17d812b 100644 (file)
@@ -110,8 +110,7 @@ ip_vs_app_inc_new(struct ip_vs_app *app, __u16 proto, __u16 port)
        return 0;
 
   out:
-       if (inc->timeout_table)
-               kfree(inc->timeout_table);
+       kfree(inc->timeout_table);
        kfree(inc);
        return ret;
 }
@@ -136,8 +135,7 @@ ip_vs_app_inc_release(struct ip_vs_app *inc)
 
        list_del(&inc->a_list);
 
-       if (inc->timeout_table != NULL)
-               kfree(inc->timeout_table);
+       kfree(inc->timeout_table);
        kfree(inc);
 }
 
index bd7d75b6abe0a6a7e1ed63d78b5d18becf3eb961..d34a9fa608e0b88dec20adaa567100a5b63c4ee0 100644 (file)
@@ -207,16 +207,12 @@ static void wrandom_select_route(const struct flowi *flp,
                        decision = mpc->rt;
 
                last_power = mpc->power;
-               if (last_mpc)
-                       kfree(last_mpc);
-
+               kfree(last_mpc);
                last_mpc = mpc;
        }
 
-       if (last_mpc) {
-               /* concurrent __multipath_flush may lead to !last_mpc */
-               kfree(last_mpc);
-       }
+       /* concurrent __multipath_flush may lead to !last_mpc */
+       kfree(last_mpc);
 
        decision->u.dst.__use++;
        *rp = decision;
index 93b2c5111bb2338b15f765ed604866d4a860310b..8acb7ed40b47f7c5e25adae81f774601ffaa15ba 100644 (file)
@@ -1161,8 +1161,7 @@ static int snmp_parse_mangle(unsigned char *msg,
                
                if (!snmp_object_decode(&ctx, obj)) {
                        if (*obj) {
-                               if ((*obj)->id)
-                                       kfree((*obj)->id);
+                               kfree((*obj)->id);
                                kfree(*obj);
                        }       
                        kfree(obj);
index 49d67cd75eddcf07a79946c8204fa1265cbca498..634dabb558fd6f5942e709c99846f83985db8b41 100644 (file)
@@ -823,8 +823,7 @@ out:
  */
 static void tcp_v4_reqsk_destructor(struct request_sock *req)
 {
-       if (inet_rsk(req)->opt)
-               kfree(inet_rsk(req)->opt);
+       kfree(inet_rsk(req)->opt);
 }
 
 static inline void syn_flood_warning(struct sk_buff *skb)
index a34d1504deb9b901d5f002b69bdee761147b7d5d..b7a5f51238b3958f88bc18adfac17704d3aa0bf7 100644 (file)
@@ -3090,8 +3090,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
 
 nlmsg_failure:
 rtattr_failure:
-       if (array)
-               kfree(array);
+       kfree(array);
        skb_trim(skb, b - skb->data);
        return -1;
 }
index 614296a920c6ab189b58607726eea55bee4d0426..dbd9767b32e45ee3373e94ae20afee2b5449a83c 100644 (file)
@@ -587,8 +587,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
                        skb->next = NULL;
                }
 
-               if (tmp_hdr)
-                       kfree(tmp_hdr);
+               kfree(tmp_hdr);
 
                if (err == 0) {
                        IP6_INC_STATS(IPSTATS_MIB_FRAGOKS);
@@ -1186,10 +1185,8 @@ int ip6_push_pending_frames(struct sock *sk)
 
 out:
        inet->cork.flags &= ~IPCORK_OPT;
-       if (np->cork.opt) {
-               kfree(np->cork.opt);
-               np->cork.opt = NULL;
-       }
+       kfree(np->cork.opt);
+       np->cork.opt = NULL;
        if (np->cork.rt) {
                dst_release(&np->cork.rt->u.dst);
                np->cork.rt = NULL;
@@ -1214,10 +1211,8 @@ void ip6_flush_pending_frames(struct sock *sk)
 
        inet->cork.flags &= ~IPCORK_OPT;
 
-       if (np->cork.opt) {
-               kfree(np->cork.opt);
-               np->cork.opt = NULL;
-       }
+       kfree(np->cork.opt);
+       np->cork.opt = NULL;
        if (np->cork.rt) {
                dst_release(&np->cork.rt->u.dst);
                np->cork.rt = NULL;
index cf94372d1af39980b108f3161fd8d94837e0f94c..e6b0e3954c02be114b6bba4f2e14007ff069d1db 100644 (file)
@@ -756,8 +756,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
        }
        ip6_tnl_dst_store(t, dst);
 
-       if (opt)
-               kfree(opt);
+       kfree(opt);
 
        t->recursion--;
        return 0;
@@ -766,8 +765,7 @@ tx_err_link_failure:
        dst_link_failure(skb);
 tx_err_dst_release:
        dst_release(dst);
-       if (opt)
-               kfree(opt);
+       kfree(opt);
 tx_err:
        stats->tx_errors++;
        stats->tx_dropped++;
index 85bfbc69b2c3dc716618f6e528dfcb63658e96b5..55917fb170949cfdcd5dd427dc8baf7201c14a17 100644 (file)
@@ -130,8 +130,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s
 out_put_cpu:
        put_cpu();
 out:
-       if (tmp_hdr)
-               kfree(tmp_hdr);
+       kfree(tmp_hdr);
        if (err)
                goto error_out;
        return nexthdr;
index 8567873d0dd85fabd972537eccce7d79d8107611..003fd99ff597d6f4332008c90f6bdcb2b9e80493 100644 (file)
@@ -80,8 +80,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *))
                if (ra->sk == sk) {
                        if (sel>=0) {
                                write_unlock_bh(&ip6_ra_lock);
-                               if (new_ra)
-                                       kfree(new_ra);
+                               kfree(new_ra);
                                return -EADDRINUSE;
                        }
 
index c4ba5fa1446a47da6ba85981cc8c4a7e693e73ad..3fefc822c1c087c2cebd4baadb646ef771442784 100644 (file)
@@ -194,8 +194,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force)
 
                        /* Remove it from the log */
                        curr = hashbin_remove_this(log, (irda_queue_t *) curr);
-                       if (curr)
-                               kfree(curr);
+                       kfree(curr);
                }
        }
 
index 6fec428b45123df937bff9b6bc177a24fa793d41..75f2666e863056d7255875285c5188fee69042cd 100644 (file)
@@ -122,8 +122,7 @@ static void __irias_delete_attrib(struct ias_attrib *attrib)
        IRDA_ASSERT(attrib != NULL, return;);
        IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;);
 
-       if (attrib->name)
-               kfree(attrib->name);
+       kfree(attrib->name);
 
        irias_delete_value(attrib->value);
        attrib->magic = ~IAS_ATTRIB_MAGIC;
@@ -136,8 +135,7 @@ void __irias_delete_object(struct ias_object *obj)
        IRDA_ASSERT(obj != NULL, return;);
        IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
 
-       if (obj->name)
-               kfree(obj->name);
+       kfree(obj->name);
 
        hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib);
 
@@ -562,14 +560,12 @@ void irias_delete_value(struct ias_value *value)
                /* No need to deallocate */
                break;
        case IAS_STRING:
-               /* If string, deallocate string */
-               if (value->t.string != NULL)
-                       kfree(value->t.string);
+               /* Deallocate string */
+               kfree(value->t.string);
                break;
        case IAS_OCT_SEQ:
-               /* If byte stream, deallocate byte stream */
-                if (value->t.oct_seq != NULL)
-                        kfree(value->t.oct_seq);
+               /* Deallocate byte stream */
+                kfree(value->t.oct_seq);
                 break;
        default:
                IRDA_DEBUG(0, "%s(), Unknown value type!\n", __FUNCTION__);
index b18fe504301944d8514816df8d6eb90f715b048d..8631b65a7312c830d35e4d843163024432bac54e 100644 (file)
@@ -240,8 +240,7 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
        if ((s = rose_neigh_list) == rose_neigh) {
                rose_neigh_list = rose_neigh->next;
                spin_unlock_bh(&rose_neigh_list_lock);
-               if (rose_neigh->digipeat != NULL)
-                       kfree(rose_neigh->digipeat);
+               kfree(rose_neigh->digipeat);
                kfree(rose_neigh);
                return;
        }
@@ -250,8 +249,7 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
                if (s->next == rose_neigh) {
                        s->next = rose_neigh->next;
                        spin_unlock_bh(&rose_neigh_list_lock);
-                       if (rose_neigh->digipeat != NULL)
-                               kfree(rose_neigh->digipeat);
+                       kfree(rose_neigh->digipeat);
                        kfree(rose_neigh);
                        return;
                }
index 29d8b9a4d162f2aa72b38f3df3f68e9f1ffe625e..75470486e4050edb23e4db439a3228adfbfc170e 100644 (file)
@@ -298,8 +298,7 @@ static int fw_change(struct tcf_proto *tp, unsigned long base,
        return 0;
 
 errout:
-       if (f)
-               kfree(f);
+       kfree(f);
        return err;
 }
 
index 02996ac05c75d11b738649fd3069abeb17b82bdd..520ff716dab2f0d744845747366f320dd83f9434 100644 (file)
@@ -525,8 +525,7 @@ reinsert:
        return 0;
 
 errout:
-       if (f)
-               kfree(f);
+       kfree(f);
        return err;
 }
 
index 006168d6937654d7ece5493fad1b96cad9e0806b..572f06be3b02a181447c1e125056a833687ef017 100644 (file)
@@ -555,8 +555,7 @@ insert:
        goto insert;
 
 errout:
-       if (f)
-               kfree(f);
+       kfree(f);
 errout2:
        tcf_exts_destroy(tp, &e);
        return err;
index 404d9d83a7fab040efab32341db2732b31626cf9..9f921174c8ab39d33e9544c9b78051b3b8a12cdf 100644 (file)
@@ -194,8 +194,7 @@ found:
        }
        tcf_unbind_filter(tp, &r->res);
        tcf_exts_destroy(tp, &r->exts);
-       if (f)
-               kfree(f);
+       kfree(f);
        return 0;
 }
 
@@ -442,10 +441,8 @@ static void tcindex_destroy(struct tcf_proto *tp)
        walker.skip = 0;
        walker.fn = &tcindex_destroy_element;
        tcindex_walk(tp,&walker);
-       if (p->perfect)
-               kfree(p->perfect);
-       if (p->h)
-               kfree(p->h);
+       kfree(p->perfect);
+       kfree(p->h);
        kfree(p);
        tp->root = NULL;
 }
index 364b87d86455dc8671d17d8fbeceb4ae9d1d51e8..2b670479dde1d68ea192e641dbe69ffb754bf9f4 100644 (file)
@@ -347,7 +347,7 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n)
        if (n->ht_down)
                n->ht_down->refcnt--;
 #ifdef CONFIG_CLS_U32_PERF
-       if (n && (NULL != n->pf))
+       if (n)
                kfree(n->pf);
 #endif
        kfree(n);
@@ -680,7 +680,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
                return 0;
        }
 #ifdef CONFIG_CLS_U32_PERF
-       if (n && (NULL != n->pf))
+       if (n)
                kfree(n->pf);
 #endif
        kfree(n);
index cf68a59fdc5a4d4d6ac2bfbd5b63f99cd4574cee..700844d49d795d36acffd22815b5fb4f15ec3ce9 100644 (file)
@@ -561,8 +561,7 @@ static int meta_var_change(struct meta_value *dst, struct rtattr *rta)
 
 static void meta_var_destroy(struct meta_value *v)
 {
-       if (v->val)
-               kfree((void *) v->val);
+       kfree((void *) v->val);
 }
 
 static void meta_var_apply_extras(struct meta_value *v,
index 12b0f582a66b29707941da349b3f63582e5c0407..8c8ddf7f9b61c7c9ca7a804f8cbf8101fc151aa9 100644 (file)
@@ -344,9 +344,7 @@ void sctp_association_free(struct sctp_association *asoc)
        }
 
        /* Free peer's cached cookie. */
-       if (asoc->peer.cookie) {
-               kfree(asoc->peer.cookie);
-       }
+       kfree(asoc->peer.cookie);
 
        /* Release the transport structures. */
        list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
index 660c61bdf16423c883dff5291fd60e2067b552d9..f9573eba5c7aa2f5507c12c0ff55a75e0e700490 100644 (file)
@@ -254,8 +254,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
        aiparam.adaption_ind = htonl(sp->adaption_ind);
        sctp_addto_chunk(retval, sizeof(aiparam), &aiparam);
 nodata:
-       if (addrs.v)
-               kfree(addrs.v);
+       kfree(addrs.v);
        return retval;
 }
 
@@ -347,8 +346,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
 nomem_chunk:
        kfree(cookie);
 nomem_cookie:
-       if (addrs.v)
-               kfree(addrs.v);
+       kfree(addrs.v);
        return retval;
 }
 
index 13f8ae9794542d436f82274bff2e38c0a7724f18..d0dfdfd5e79efa926140d23e10ecba89e16cc381 100644 (file)
@@ -143,6 +143,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
 
        return ((ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE);
 out_err:
-       if (md5cksum.data) kfree(md5cksum.data);
+       kfree(md5cksum.data);
        return GSS_S_FAILURE;
 }
index 2030475d98ed26b22632a6dc6f01068ef6f92947..db055fd7d7789c22ef62e4e8faab7ebac7cafebd 100644 (file)
@@ -176,6 +176,6 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,
 
        ret = GSS_S_COMPLETE;
 out:
-       if (md5cksum.data) kfree(md5cksum.data);
+       kfree(md5cksum.data);
        return ret;
 }
index b048bf672da2bbffbe35953b3e47a57b7e2383d3..f8bac6ccd524008a669c4e603d8526b9dabb006b 100644 (file)
@@ -60,8 +60,7 @@ gss_mech_free(struct gss_api_mech *gm)
 
        for (i = 0; i < gm->gm_pf_num; i++) {
                pf = &gm->gm_pfs[i];
-               if (pf->auth_domain_name)
-                       kfree(pf->auth_domain_name);
+               kfree(pf->auth_domain_name);
                pf->auth_domain_name = NULL;
        }
 }
index 148201e929d08de77ca44f6b6dfbe8da20ab7e04..d1e12b25d6e21f2b4e205c49b3ddd0d0fb7580b6 100644 (file)
@@ -122,8 +122,7 @@ spkm3_make_token(struct spkm3_ctx *ctx,
 
        return  GSS_S_COMPLETE;
 out_err:
-       if (md5cksum.data) 
-               kfree(md5cksum.data);
+       kfree(md5cksum.data);
        token->data = NULL;
        token->len = 0;
        return GSS_S_FAILURE;
index 46c08a0710f62e147f0a4c6b4e6502be5a89ebbd..1f824578d773691c17c67daa6f76e9096730a789 100644 (file)
@@ -259,8 +259,7 @@ spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen, unsigned char **ck
 
        ret = GSS_S_COMPLETE;
 out:
-       if (spkm3_ctx_id.data)
-               kfree(spkm3_ctx_id.data);
+       kfree(spkm3_ctx_id.data);
        return ret;
 }
 
index c3c0d95861039958305e89f437174b8c3bc13272..241d5b30dfcbcfb851093856f88b79698da35a81 100644 (file)
@@ -120,9 +120,7 @@ spkm3_read_token(struct spkm3_ctx *ctx,
        /* XXX: need to add expiration and sequencing */
        ret = GSS_S_COMPLETE;
 out:
-       if (md5cksum.data) 
-               kfree(md5cksum.data);
-       if (wire_cksum.data) 
-               kfree(wire_cksum.data);
+       kfree(md5cksum.data);
+       kfree(wire_cksum.data);
        return ret;
 }
index 5a220b2bb376f4669ecf4d267d1fa261d0b5b847..e4296c8b861eba85fead5bf1d839aa212e59ac7c 100644 (file)
@@ -196,12 +196,9 @@ svc_exit_thread(struct svc_rqst *rqstp)
        struct svc_serv *serv = rqstp->rq_server;
 
        svc_release_buffer(rqstp);
-       if (rqstp->rq_resp)
-               kfree(rqstp->rq_resp);
-       if (rqstp->rq_argp)
-               kfree(rqstp->rq_argp);
-       if (rqstp->rq_auth_data)
-               kfree(rqstp->rq_auth_data);
+       kfree(rqstp->rq_resp);
+       kfree(rqstp->rq_argp);
+       kfree(rqstp->rq_auth_data);
        kfree(rqstp);
 
        /* Release the server */
index 32df43372ee97cc277ed54d058f77667c8985160..aaf08cdd19f09fad9b9a36e7cdd8041606dbfd6e 100644 (file)
@@ -992,8 +992,7 @@ xdr_xcode_array2(struct xdr_buf *buf, unsigned int base,
        err = 0;
 
 out:
-       if (elem)
-               kfree(elem);
+       kfree(elem);
        if (ppages)
                kunmap(*ppages);
        return err;
index 596cb96e5f471227c348ce214d46dce63f5cf4a7..59fec59b2132df1ab43e782d2a469a84bf373dd0 100644 (file)
@@ -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);
index 13b650ad22e21a6a6bec891d5bfe8ce4efb52236..bcf7b3faa76a4020d6308f5998fead39cce7b961 100644 (file)
@@ -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);
 
index 8b9a4747417d00bbf4c6b9050f59f7ca4eb24951..7cf48aa6c95bdb48a9438c6c4a3159fefe403869 100644 (file)
@@ -62,14 +62,10 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
 {
        if (del_timer(&x->timer))
                BUG();
-       if (x->aalg)
-               kfree(x->aalg);
-       if (x->ealg)
-               kfree(x->ealg);
-       if (x->calg)
-               kfree(x->calg);
-       if (x->encap)
-               kfree(x->encap);
+       kfree(x->aalg);
+       kfree(x->ealg);
+       kfree(x->calg);
+       kfree(x->encap);
        if (x->type) {
                x->type->destructor(x);
                xfrm_put_type(x->type);