Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Jesper Juhl and committed by
David S. Miller
a51482bd ac7c98ec

+99 -191
+1 -2
net/802/p8023.c
··· 54 54 */ 55 55 void destroy_8023_client(struct datalink_proto *dl) 56 56 { 57 - if (dl) 58 - kfree(dl); 57 + kfree(dl); 59 58 } 60 59 61 60 EXPORT_SYMBOL(destroy_8023_client);
+2 -4
net/ax25/af_ax25.c
··· 1138 1138 sk->sk_state = TCP_CLOSE; 1139 1139 sock->state = SS_UNCONNECTED; 1140 1140 1141 - if (ax25->digipeat != NULL) { 1142 - kfree(ax25->digipeat); 1143 - ax25->digipeat = NULL; 1144 - } 1141 + kfree(ax25->digipeat); 1142 + ax25->digipeat = NULL; 1145 1143 1146 1144 /* 1147 1145 * Handle digi-peaters to be used.
+2 -4
net/ax25/ax25_in.c
··· 401 401 } 402 402 403 403 if (dp.ndigi == 0) { 404 - if (ax25->digipeat != NULL) { 405 - kfree(ax25->digipeat); 406 - ax25->digipeat = NULL; 407 - } 404 + kfree(ax25->digipeat); 405 + ax25->digipeat = NULL; 408 406 } else { 409 407 /* Reverse the source SABM's path */ 410 408 memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi));
+6 -13
net/ax25/ax25_route.c
··· 54 54 if (s->dev == dev) { 55 55 if (ax25_route_list == s) { 56 56 ax25_route_list = s->next; 57 - if (s->digipeat != NULL) 58 - kfree(s->digipeat); 57 + kfree(s->digipeat); 59 58 kfree(s); 60 59 } else { 61 60 for (t = ax25_route_list; t != NULL; t = t->next) { 62 61 if (t->next == s) { 63 62 t->next = s->next; 64 - if (s->digipeat != NULL) 65 - kfree(s->digipeat); 63 + kfree(s->digipeat); 66 64 kfree(s); 67 65 break; 68 66 } ··· 88 90 while (ax25_rt != NULL) { 89 91 if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 && 90 92 ax25_rt->dev == ax25_dev->dev) { 91 - if (ax25_rt->digipeat != NULL) { 92 - kfree(ax25_rt->digipeat); 93 - ax25_rt->digipeat = NULL; 94 - } 93 + kfree(ax25_rt->digipeat); 94 + ax25_rt->digipeat = NULL; 95 95 if (route->digi_count != 0) { 96 96 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { 97 97 write_unlock(&ax25_route_lock); ··· 141 145 static void ax25_rt_destroy(ax25_route *ax25_rt) 142 146 { 143 147 if (atomic_read(&ax25_rt->ref) == 0) { 144 - if (ax25_rt->digipeat != NULL) 145 - kfree(ax25_rt->digipeat); 148 + kfree(ax25_rt->digipeat); 146 149 kfree(ax25_rt); 147 150 return; 148 151 } ··· 525 530 s = ax25_rt; 526 531 ax25_rt = ax25_rt->next; 527 532 528 - if (s->digipeat != NULL) 529 - kfree(s->digipeat); 530 - 533 + kfree(s->digipeat); 531 534 kfree(s); 532 535 } 533 536 write_unlock(&ax25_route_lock);
+1 -3
net/bluetooth/hidp/core.c
··· 660 660 failed: 661 661 up_write(&hidp_session_sem); 662 662 663 - if (session->input) 664 - kfree(session->input); 665 - 663 + kfree(session->input); 666 664 kfree(session); 667 665 return err; 668 666 }
+1 -2
net/core/dev_mcast.c
··· 194 194 195 195 done: 196 196 spin_unlock_bh(&dev->xmit_lock); 197 - if (dmi1) 198 - kfree(dmi1); 197 + kfree(dmi1); 199 198 return err; 200 199 } 201 200
+1 -2
net/core/sock.c
··· 1242 1242 1243 1243 static void sock_def_destruct(struct sock *sk) 1244 1244 { 1245 - if (sk->sk_protinfo) 1246 - kfree(sk->sk_protinfo); 1245 + kfree(sk->sk_protinfo); 1247 1246 } 1248 1247 1249 1248 void sk_send_sigurg(struct sock *sk)
+2 -4
net/dccp/ipv4.c
··· 1263 1263 if (inet_csk(sk)->icsk_bind_hash != NULL) 1264 1264 inet_put_port(&dccp_hashinfo, sk); 1265 1265 1266 - if (dp->dccps_service_list != NULL) { 1267 - kfree(dp->dccps_service_list); 1268 - dp->dccps_service_list = NULL; 1269 - } 1266 + kfree(dp->dccps_service_list); 1267 + dp->dccps_service_list = NULL; 1270 1268 1271 1269 ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk); 1272 1270 ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk);
+1 -2
net/dccp/proto.c
··· 238 238 lock_sock(sk); 239 239 dp->dccps_service = service; 240 240 241 - if (dp->dccps_service_list != NULL) 242 - kfree(dp->dccps_service_list); 241 + kfree(dp->dccps_service_list); 243 242 244 243 dp->dccps_service_list = sl; 245 244 release_sock(sk);
+6 -8
net/decnet/dn_table.c
··· 784 784 785 785 static void dn_fib_del_tree(int n) 786 786 { 787 - struct dn_fib_table *t; 787 + struct dn_fib_table *t; 788 788 789 - write_lock(&dn_fib_tables_lock); 790 - t = dn_fib_tables[n]; 791 - dn_fib_tables[n] = NULL; 792 - write_unlock(&dn_fib_tables_lock); 789 + write_lock(&dn_fib_tables_lock); 790 + t = dn_fib_tables[n]; 791 + dn_fib_tables[n] = NULL; 792 + write_unlock(&dn_fib_tables_lock); 793 793 794 - if (t) { 795 - kfree(t); 796 - } 794 + kfree(t); 797 795 } 798 796 799 797 struct dn_fib_table *dn_fib_empty_table(void)
+1 -2
net/ethernet/pe2.c
··· 32 32 33 33 void destroy_EII_client(struct datalink_proto *dl) 34 34 { 35 - if (dl) 36 - kfree(dl); 35 + kfree(dl); 37 36 } 38 37 39 38 EXPORT_SYMBOL(destroy_EII_client);
+1 -2
net/ipv4/af_inet.c
··· 147 147 BUG_TRAP(!sk->sk_wmem_queued); 148 148 BUG_TRAP(!sk->sk_forward_alloc); 149 149 150 - if (inet->opt) 151 - kfree(inet->opt); 150 + kfree(inet->opt); 152 151 dst_release(sk->sk_dst_cache); 153 152 sk_refcnt_debug_dec(sk); 154 153 }
+1 -2
net/ipv4/fib_frontend.c
··· 266 266 if (tb) 267 267 err = tb->tb_insert(tb, &req.rtm, &rta, &req.nlh, NULL); 268 268 } 269 - if (rta.rta_mx) 270 - kfree(rta.rta_mx); 269 + kfree(rta.rta_mx); 271 270 } 272 271 rtnl_unlock(); 273 272 return err;
+1 -2
net/ipv4/ip_options.c
··· 510 510 kfree(opt); 511 511 return -EINVAL; 512 512 } 513 - if (*optp) 514 - kfree(*optp); 513 + kfree(*optp); 515 514 *optp = opt; 516 515 return 0; 517 516 }
+4 -8
net/ipv4/ip_output.c
··· 1262 1262 1263 1263 out: 1264 1264 inet->cork.flags &= ~IPCORK_OPT; 1265 - if (inet->cork.opt) { 1266 - kfree(inet->cork.opt); 1267 - inet->cork.opt = NULL; 1268 - } 1265 + kfree(inet->cork.opt); 1266 + inet->cork.opt = NULL; 1269 1267 if (inet->cork.rt) { 1270 1268 ip_rt_put(inet->cork.rt); 1271 1269 inet->cork.rt = NULL; ··· 1287 1289 kfree_skb(skb); 1288 1290 1289 1291 inet->cork.flags &= ~IPCORK_OPT; 1290 - if (inet->cork.opt) { 1291 - kfree(inet->cork.opt); 1292 - inet->cork.opt = NULL; 1293 - } 1292 + kfree(inet->cork.opt); 1293 + inet->cork.opt = NULL; 1294 1294 if (inet->cork.rt) { 1295 1295 ip_rt_put(inet->cork.rt); 1296 1296 inet->cork.rt = NULL;
+4 -8
net/ipv4/ip_sockglue.c
··· 202 202 if (ra->sk == sk) { 203 203 if (on) { 204 204 write_unlock_bh(&ip_ra_lock); 205 - if (new_ra) 206 - kfree(new_ra); 205 + kfree(new_ra); 207 206 return -EADDRINUSE; 208 207 } 209 208 *rap = ra->next; ··· 445 446 #endif 446 447 } 447 448 opt = xchg(&inet->opt, opt); 448 - if (opt) 449 - kfree(opt); 449 + kfree(opt); 450 450 break; 451 451 } 452 452 case IP_PKTINFO: ··· 826 828 827 829 err = ip_mc_msfilter(sk, msf, ifindex); 828 830 mc_msf_out: 829 - if (msf) 830 - kfree(msf); 831 - if (gsf) 832 - kfree(gsf); 831 + kfree(msf); 832 + kfree(gsf); 833 833 break; 834 834 } 835 835 case IP_ROUTER_ALERT:
+2 -4
net/ipv4/ipvs/ip_vs_app.c
··· 110 110 return 0; 111 111 112 112 out: 113 - if (inc->timeout_table) 114 - kfree(inc->timeout_table); 113 + kfree(inc->timeout_table); 115 114 kfree(inc); 116 115 return ret; 117 116 } ··· 135 136 136 137 list_del(&inc->a_list); 137 138 138 - if (inc->timeout_table != NULL) 139 - kfree(inc->timeout_table); 139 + kfree(inc->timeout_table); 140 140 kfree(inc); 141 141 } 142 142
+3 -7
net/ipv4/multipath_wrandom.c
··· 207 207 decision = mpc->rt; 208 208 209 209 last_power = mpc->power; 210 - if (last_mpc) 211 - kfree(last_mpc); 212 - 210 + kfree(last_mpc); 213 211 last_mpc = mpc; 214 212 } 215 213 216 - if (last_mpc) { 217 - /* concurrent __multipath_flush may lead to !last_mpc */ 218 - kfree(last_mpc); 219 - } 214 + /* concurrent __multipath_flush may lead to !last_mpc */ 215 + kfree(last_mpc); 220 216 221 217 decision->u.dst.__use++; 222 218 *rp = decision;
+1 -2
net/ipv4/netfilter/ip_nat_snmp_basic.c
··· 1161 1161 1162 1162 if (!snmp_object_decode(&ctx, obj)) { 1163 1163 if (*obj) { 1164 - if ((*obj)->id) 1165 - kfree((*obj)->id); 1164 + kfree((*obj)->id); 1166 1165 kfree(*obj); 1167 1166 } 1168 1167 kfree(obj);
+1 -2
net/ipv4/tcp_ipv4.c
··· 823 823 */ 824 824 static void tcp_v4_reqsk_destructor(struct request_sock *req) 825 825 { 826 - if (inet_rsk(req)->opt) 827 - kfree(inet_rsk(req)->opt); 826 + kfree(inet_rsk(req)->opt); 828 827 } 829 828 830 829 static inline void syn_flood_warning(struct sk_buff *skb)
+1 -2
net/ipv6/addrconf.c
··· 3090 3090 3091 3091 nlmsg_failure: 3092 3092 rtattr_failure: 3093 - if (array) 3094 - kfree(array); 3093 + kfree(array); 3095 3094 skb_trim(skb, b - skb->data); 3096 3095 return -1; 3097 3096 }
+5 -10
net/ipv6/ip6_output.c
··· 587 587 skb->next = NULL; 588 588 } 589 589 590 - if (tmp_hdr) 591 - kfree(tmp_hdr); 590 + kfree(tmp_hdr); 592 591 593 592 if (err == 0) { 594 593 IP6_INC_STATS(IPSTATS_MIB_FRAGOKS); ··· 1185 1186 1186 1187 out: 1187 1188 inet->cork.flags &= ~IPCORK_OPT; 1188 - if (np->cork.opt) { 1189 - kfree(np->cork.opt); 1190 - np->cork.opt = NULL; 1191 - } 1189 + kfree(np->cork.opt); 1190 + np->cork.opt = NULL; 1192 1191 if (np->cork.rt) { 1193 1192 dst_release(&np->cork.rt->u.dst); 1194 1193 np->cork.rt = NULL; ··· 1211 1214 1212 1215 inet->cork.flags &= ~IPCORK_OPT; 1213 1216 1214 - if (np->cork.opt) { 1215 - kfree(np->cork.opt); 1216 - np->cork.opt = NULL; 1217 - } 1217 + kfree(np->cork.opt); 1218 + np->cork.opt = NULL; 1218 1219 if (np->cork.rt) { 1219 1220 dst_release(&np->cork.rt->u.dst); 1220 1221 np->cork.rt = NULL;
+2 -4
net/ipv6/ip6_tunnel.c
··· 756 756 } 757 757 ip6_tnl_dst_store(t, dst); 758 758 759 - if (opt) 760 - kfree(opt); 759 + kfree(opt); 761 760 762 761 t->recursion--; 763 762 return 0; ··· 765 766 dst_link_failure(skb); 766 767 tx_err_dst_release: 767 768 dst_release(dst); 768 - if (opt) 769 - kfree(opt); 769 + kfree(opt); 770 770 tx_err: 771 771 stats->tx_errors++; 772 772 stats->tx_dropped++;
+1 -2
net/ipv6/ipcomp6.c
··· 130 130 out_put_cpu: 131 131 put_cpu(); 132 132 out: 133 - if (tmp_hdr) 134 - kfree(tmp_hdr); 133 + kfree(tmp_hdr); 135 134 if (err) 136 135 goto error_out; 137 136 return nexthdr;
+1 -2
net/ipv6/ipv6_sockglue.c
··· 80 80 if (ra->sk == sk) { 81 81 if (sel>=0) { 82 82 write_unlock_bh(&ip6_ra_lock); 83 - if (new_ra) 84 - kfree(new_ra); 83 + kfree(new_ra); 85 84 return -EADDRINUSE; 86 85 } 87 86
+1 -2
net/irda/discovery.c
··· 194 194 195 195 /* Remove it from the log */ 196 196 curr = hashbin_remove_this(log, (irda_queue_t *) curr); 197 - if (curr) 198 - kfree(curr); 197 + kfree(curr); 199 198 } 200 199 } 201 200
+6 -10
net/irda/irias_object.c
··· 122 122 IRDA_ASSERT(attrib != NULL, return;); 123 123 IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;); 124 124 125 - if (attrib->name) 126 - kfree(attrib->name); 125 + kfree(attrib->name); 127 126 128 127 irias_delete_value(attrib->value); 129 128 attrib->magic = ~IAS_ATTRIB_MAGIC; ··· 135 136 IRDA_ASSERT(obj != NULL, return;); 136 137 IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); 137 138 138 - if (obj->name) 139 - kfree(obj->name); 139 + kfree(obj->name); 140 140 141 141 hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib); 142 142 ··· 560 562 /* No need to deallocate */ 561 563 break; 562 564 case IAS_STRING: 563 - /* If string, deallocate string */ 564 - if (value->t.string != NULL) 565 - kfree(value->t.string); 565 + /* Deallocate string */ 566 + kfree(value->t.string); 566 567 break; 567 568 case IAS_OCT_SEQ: 568 - /* If byte stream, deallocate byte stream */ 569 - if (value->t.oct_seq != NULL) 570 - kfree(value->t.oct_seq); 569 + /* Deallocate byte stream */ 570 + kfree(value->t.oct_seq); 571 571 break; 572 572 default: 573 573 IRDA_DEBUG(0, "%s(), Unknown value type!\n", __FUNCTION__);
+2 -4
net/rose/rose_route.c
··· 240 240 if ((s = rose_neigh_list) == rose_neigh) { 241 241 rose_neigh_list = rose_neigh->next; 242 242 spin_unlock_bh(&rose_neigh_list_lock); 243 - if (rose_neigh->digipeat != NULL) 244 - kfree(rose_neigh->digipeat); 243 + kfree(rose_neigh->digipeat); 245 244 kfree(rose_neigh); 246 245 return; 247 246 } ··· 249 250 if (s->next == rose_neigh) { 250 251 s->next = rose_neigh->next; 251 252 spin_unlock_bh(&rose_neigh_list_lock); 252 - if (rose_neigh->digipeat != NULL) 253 - kfree(rose_neigh->digipeat); 253 + kfree(rose_neigh->digipeat); 254 254 kfree(rose_neigh); 255 255 return; 256 256 }
+1 -2
net/sched/cls_fw.c
··· 298 298 return 0; 299 299 300 300 errout: 301 - if (f) 302 - kfree(f); 301 + kfree(f); 303 302 return err; 304 303 } 305 304
+1 -2
net/sched/cls_route.c
··· 525 525 return 0; 526 526 527 527 errout: 528 - if (f) 529 - kfree(f); 528 + kfree(f); 530 529 return err; 531 530 } 532 531
+1 -2
net/sched/cls_rsvp.h
··· 555 555 goto insert; 556 556 557 557 errout: 558 - if (f) 559 - kfree(f); 558 + kfree(f); 560 559 errout2: 561 560 tcf_exts_destroy(tp, &e); 562 561 return err;
+3 -6
net/sched/cls_tcindex.c
··· 194 194 } 195 195 tcf_unbind_filter(tp, &r->res); 196 196 tcf_exts_destroy(tp, &r->exts); 197 - if (f) 198 - kfree(f); 197 + kfree(f); 199 198 return 0; 200 199 } 201 200 ··· 441 442 walker.skip = 0; 442 443 walker.fn = &tcindex_destroy_element; 443 444 tcindex_walk(tp,&walker); 444 - if (p->perfect) 445 - kfree(p->perfect); 446 - if (p->h) 447 - kfree(p->h); 445 + kfree(p->perfect); 446 + kfree(p->h); 448 447 kfree(p); 449 448 tp->root = NULL; 450 449 }
+2 -2
net/sched/cls_u32.c
··· 347 347 if (n->ht_down) 348 348 n->ht_down->refcnt--; 349 349 #ifdef CONFIG_CLS_U32_PERF 350 - if (n && (NULL != n->pf)) 350 + if (n) 351 351 kfree(n->pf); 352 352 #endif 353 353 kfree(n); ··· 680 680 return 0; 681 681 } 682 682 #ifdef CONFIG_CLS_U32_PERF 683 - if (n && (NULL != n->pf)) 683 + if (n) 684 684 kfree(n->pf); 685 685 #endif 686 686 kfree(n);
+1 -2
net/sched/em_meta.c
··· 561 561 562 562 static void meta_var_destroy(struct meta_value *v) 563 563 { 564 - if (v->val) 565 - kfree((void *) v->val); 564 + kfree((void *) v->val); 566 565 } 567 566 568 567 static void meta_var_apply_extras(struct meta_value *v,
+1 -3
net/sctp/associola.c
··· 344 344 } 345 345 346 346 /* Free peer's cached cookie. */ 347 - if (asoc->peer.cookie) { 348 - kfree(asoc->peer.cookie); 349 - } 347 + kfree(asoc->peer.cookie); 350 348 351 349 /* Release the transport structures. */ 352 350 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
+2 -4
net/sctp/sm_make_chunk.c
··· 254 254 aiparam.adaption_ind = htonl(sp->adaption_ind); 255 255 sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); 256 256 nodata: 257 - if (addrs.v) 258 - kfree(addrs.v); 257 + kfree(addrs.v); 259 258 return retval; 260 259 } 261 260 ··· 346 347 nomem_chunk: 347 348 kfree(cookie); 348 349 nomem_cookie: 349 - if (addrs.v) 350 - kfree(addrs.v); 350 + kfree(addrs.v); 351 351 return retval; 352 352 } 353 353
+1 -1
net/sunrpc/auth_gss/gss_krb5_seal.c
··· 143 143 144 144 return ((ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE); 145 145 out_err: 146 - if (md5cksum.data) kfree(md5cksum.data); 146 + kfree(md5cksum.data); 147 147 return GSS_S_FAILURE; 148 148 }
+1 -1
net/sunrpc/auth_gss/gss_krb5_unseal.c
··· 176 176 177 177 ret = GSS_S_COMPLETE; 178 178 out: 179 - if (md5cksum.data) kfree(md5cksum.data); 179 + kfree(md5cksum.data); 180 180 return ret; 181 181 }
+1 -2
net/sunrpc/auth_gss/gss_mech_switch.c
··· 60 60 61 61 for (i = 0; i < gm->gm_pf_num; i++) { 62 62 pf = &gm->gm_pfs[i]; 63 - if (pf->auth_domain_name) 64 - kfree(pf->auth_domain_name); 63 + kfree(pf->auth_domain_name); 65 64 pf->auth_domain_name = NULL; 66 65 } 67 66 }
+1 -2
net/sunrpc/auth_gss/gss_spkm3_seal.c
··· 122 122 123 123 return GSS_S_COMPLETE; 124 124 out_err: 125 - if (md5cksum.data) 126 - kfree(md5cksum.data); 125 + kfree(md5cksum.data); 127 126 token->data = NULL; 128 127 token->len = 0; 129 128 return GSS_S_FAILURE;
+1 -2
net/sunrpc/auth_gss/gss_spkm3_token.c
··· 259 259 260 260 ret = GSS_S_COMPLETE; 261 261 out: 262 - if (spkm3_ctx_id.data) 263 - kfree(spkm3_ctx_id.data); 262 + kfree(spkm3_ctx_id.data); 264 263 return ret; 265 264 } 266 265
+2 -4
net/sunrpc/auth_gss/gss_spkm3_unseal.c
··· 120 120 /* XXX: need to add expiration and sequencing */ 121 121 ret = GSS_S_COMPLETE; 122 122 out: 123 - if (md5cksum.data) 124 - kfree(md5cksum.data); 125 - if (wire_cksum.data) 126 - kfree(wire_cksum.data); 123 + kfree(md5cksum.data); 124 + kfree(wire_cksum.data); 127 125 return ret; 128 126 }
+3 -6
net/sunrpc/svc.c
··· 196 196 struct svc_serv *serv = rqstp->rq_server; 197 197 198 198 svc_release_buffer(rqstp); 199 - if (rqstp->rq_resp) 200 - kfree(rqstp->rq_resp); 201 - if (rqstp->rq_argp) 202 - kfree(rqstp->rq_argp); 203 - if (rqstp->rq_auth_data) 204 - kfree(rqstp->rq_auth_data); 199 + kfree(rqstp->rq_resp); 200 + kfree(rqstp->rq_argp); 201 + kfree(rqstp->rq_auth_data); 205 202 kfree(rqstp); 206 203 207 204 /* Release the server */
+1 -2
net/sunrpc/xdr.c
··· 992 992 err = 0; 993 993 994 994 out: 995 - if (elem) 996 - kfree(elem); 995 + kfree(elem); 997 996 if (ppages) 998 997 kunmap(*ppages); 999 998 return err;
+7 -13
net/wanrouter/af_wanpipe.c
··· 1099 1099 sock_reset_flag(sk, SOCK_ZAPPED); 1100 1100 wp = wp_sk(sk); 1101 1101 1102 - if (wp && wp->mbox) { 1102 + if (wp) { 1103 1103 kfree(wp->mbox); 1104 1104 wp->mbox = NULL; 1105 1105 } ··· 1186 1186 return; 1187 1187 } 1188 1188 1189 - if (wp_sk(sk)) { 1190 - kfree(wp_sk(sk)); 1191 - wp_sk(sk) = NULL; 1192 - } 1189 + kfree(wp_sk(sk)); 1190 + wp_sk(sk) = NULL; 1193 1191 1194 1192 if (atomic_read(&sk->sk_refcnt) != 1) { 1195 1193 atomic_set(&sk->sk_refcnt, 1); ··· 1217 1219 sk->sk_socket = NULL; 1218 1220 1219 1221 1220 - if (wp_sk(sk)) { 1221 - kfree(wp_sk(sk)); 1222 - wp_sk(sk) = NULL; 1223 - } 1222 + kfree(wp_sk(sk)); 1223 + wp_sk(sk) = NULL; 1224 1224 1225 1225 if (atomic_read(&sk->sk_refcnt) != 1) { 1226 1226 atomic_set(&sk->sk_refcnt, 1); ··· 1239 1243 1240 1244 sk->sk_socket = NULL; 1241 1245 1242 - if (wp_sk(sk)) { 1243 - kfree(wp_sk(sk)); 1244 - wp_sk(sk) = NULL; 1245 - } 1246 + kfree(wp_sk(sk)); 1247 + wp_sk(sk) = NULL; 1246 1248 1247 1249 if (atomic_read(&sk->sk_refcnt) != 1) { 1248 1250 atomic_set(&sk->sk_refcnt, 1);
+4 -8
net/wanrouter/wanmain.c
··· 714 714 } 715 715 716 716 /* This code has moved from del_if() function */ 717 - if (dev->priv) { 718 - kfree(dev->priv); 719 - dev->priv = NULL; 720 - } 717 + kfree(dev->priv); 718 + dev->priv = NULL; 721 719 722 720 #ifdef CONFIG_WANPIPE_MULTPPP 723 721 if (cnf->config_id == WANCONFIG_MPPP) ··· 849 851 850 852 /* Due to new interface linking method using dev->priv, 851 853 * this code has moved from del_if() function.*/ 852 - if (dev->priv){ 853 - kfree(dev->priv); 854 - dev->priv=NULL; 855 - } 854 + kfree(dev->priv); 855 + dev->priv=NULL; 856 856 857 857 unregister_netdev(dev); 858 858
+4 -8
net/xfrm/xfrm_state.c
··· 62 62 { 63 63 if (del_timer(&x->timer)) 64 64 BUG(); 65 - if (x->aalg) 66 - kfree(x->aalg); 67 - if (x->ealg) 68 - kfree(x->ealg); 69 - if (x->calg) 70 - kfree(x->calg); 71 - if (x->encap) 72 - kfree(x->encap); 65 + kfree(x->aalg); 66 + kfree(x->ealg); 67 + kfree(x->calg); 68 + kfree(x->encap); 73 69 if (x->type) { 74 70 x->type->destructor(x); 75 71 xfrm_put_type(x->type);