aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-12 14:56:44 -0500
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:11:32 -0400
commit8690bfa17aea4c42da1bcf90a7af93d161eca624 (patch)
tree88c4c5fa63aab0c18cf13228c4b3a6f980aa74be /net/rds
parent2dc393573430f853e56e25bf4b41c34ba2aa8fd6 (diff)
RDS: cleanup: remove "== NULL"s and "!= NULL"s in ptr comparisons
Favor "if (foo)" style over "if (foo != NULL)". Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/af_rds.c2
-rw-r--r--net/rds/bind.c4
-rw-r--r--net/rds/cong.c6
-rw-r--r--net/rds/connection.c4
-rw-r--r--net/rds/ib_cm.c14
-rw-r--r--net/rds/ib_recv.c20
-rw-r--r--net/rds/ib_send.c4
-rw-r--r--net/rds/ib_sysctl.c2
-rw-r--r--net/rds/info.c12
-rw-r--r--net/rds/iw_cm.c14
-rw-r--r--net/rds/iw_recv.c20
-rw-r--r--net/rds/iw_send.c4
-rw-r--r--net/rds/iw_sysctl.c2
-rw-r--r--net/rds/loop.c2
-rw-r--r--net/rds/message.c4
-rw-r--r--net/rds/page.c4
-rw-r--r--net/rds/rdma.c18
-rw-r--r--net/rds/recv.c4
-rw-r--r--net/rds/send.c14
-rw-r--r--net/rds/sysctl.c2
-rw-r--r--net/rds/tcp.c4
-rw-r--r--net/rds/tcp_connect.c2
-rw-r--r--net/rds/tcp_listen.c4
-rw-r--r--net/rds/tcp_recv.c10
-rw-r--r--net/rds/tcp_send.c2
-rw-r--r--net/rds/threads.c2
26 files changed, 90 insertions, 90 deletions
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index aebfecbdb841..63474e1f4dd8 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -62,7 +62,7 @@ static int rds_release(struct socket *sock)
62 struct rds_sock *rs; 62 struct rds_sock *rs;
63 unsigned long flags; 63 unsigned long flags;
64 64
65 if (sk == NULL) 65 if (!sk)
66 goto out; 66 goto out;
67 67
68 rs = rds_sk_to_rs(sk); 68 rs = rds_sk_to_rs(sk);
diff --git a/net/rds/bind.c b/net/rds/bind.c
index 5d95fc007f1a..65de5cbdb576 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -121,7 +121,7 @@ static int rds_add_bound(struct rds_sock *rs, __be32 addr, __be16 *port)
121 do { 121 do {
122 if (rover == 0) 122 if (rover == 0)
123 rover++; 123 rover++;
124 if (rds_bind_tree_walk(addr, cpu_to_be16(rover), rs) == NULL) { 124 if (!rds_bind_tree_walk(addr, cpu_to_be16(rover), rs)) {
125 *port = cpu_to_be16(rover); 125 *port = cpu_to_be16(rover);
126 ret = 0; 126 ret = 0;
127 break; 127 break;
@@ -184,7 +184,7 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
184 goto out; 184 goto out;
185 185
186 trans = rds_trans_get_preferred(sin->sin_addr.s_addr); 186 trans = rds_trans_get_preferred(sin->sin_addr.s_addr);
187 if (trans == NULL) { 187 if (!trans) {
188 ret = -EADDRNOTAVAIL; 188 ret = -EADDRNOTAVAIL;
189 rds_remove_bound(rs); 189 rds_remove_bound(rs);
190 if (printk_ratelimit()) 190 if (printk_ratelimit())
diff --git a/net/rds/cong.c b/net/rds/cong.c
index 0871a29f0780..c741e906d49f 100644
--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -141,7 +141,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
141 unsigned long flags; 141 unsigned long flags;
142 142
143 map = kzalloc(sizeof(struct rds_cong_map), GFP_KERNEL); 143 map = kzalloc(sizeof(struct rds_cong_map), GFP_KERNEL);
144 if (map == NULL) 144 if (!map)
145 return NULL; 145 return NULL;
146 146
147 map->m_addr = addr; 147 map->m_addr = addr;
@@ -159,7 +159,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
159 ret = rds_cong_tree_walk(addr, map); 159 ret = rds_cong_tree_walk(addr, map);
160 spin_unlock_irqrestore(&rds_cong_lock, flags); 160 spin_unlock_irqrestore(&rds_cong_lock, flags);
161 161
162 if (ret == NULL) { 162 if (!ret) {
163 ret = map; 163 ret = map;
164 map = NULL; 164 map = NULL;
165 } 165 }
@@ -205,7 +205,7 @@ int rds_cong_get_maps(struct rds_connection *conn)
205 conn->c_lcong = rds_cong_from_addr(conn->c_laddr); 205 conn->c_lcong = rds_cong_from_addr(conn->c_laddr);
206 conn->c_fcong = rds_cong_from_addr(conn->c_faddr); 206 conn->c_fcong = rds_cong_from_addr(conn->c_faddr);
207 207
208 if (conn->c_lcong == NULL || conn->c_fcong == NULL) 208 if (!(conn->c_lcong && conn->c_fcong))
209 return -ENOMEM; 209 return -ENOMEM;
210 210
211 return 0; 211 return 0;
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 895e39cdc6a6..9c9afb58a143 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -148,7 +148,7 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
148 goto out; 148 goto out;
149 149
150 conn = kmem_cache_zalloc(rds_conn_slab, gfp); 150 conn = kmem_cache_zalloc(rds_conn_slab, gfp);
151 if (conn == NULL) { 151 if (!conn) {
152 conn = ERR_PTR(-ENOMEM); 152 conn = ERR_PTR(-ENOMEM);
153 goto out; 153 goto out;
154 } 154 }
@@ -502,7 +502,7 @@ int __init rds_conn_init(void)
502 rds_conn_slab = kmem_cache_create("rds_connection", 502 rds_conn_slab = kmem_cache_create("rds_connection",
503 sizeof(struct rds_connection), 503 sizeof(struct rds_connection),
504 0, 0, NULL); 504 0, 0, NULL);
505 if (rds_conn_slab == NULL) 505 if (!rds_conn_slab)
506 return -ENOMEM; 506 return -ENOMEM;
507 507
508 rds_info_register_func(RDS_INFO_CONNECTIONS, rds_conn_info); 508 rds_info_register_func(RDS_INFO_CONNECTIONS, rds_conn_info);
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index f68832798db2..b46bc2f22ab6 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -230,7 +230,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
230 * the rds_ibdev at all. 230 * the rds_ibdev at all.
231 */ 231 */
232 rds_ibdev = ib_get_client_data(dev, &rds_ib_client); 232 rds_ibdev = ib_get_client_data(dev, &rds_ib_client);
233 if (rds_ibdev == NULL) { 233 if (!rds_ibdev) {
234 if (printk_ratelimit()) 234 if (printk_ratelimit())
235 printk(KERN_NOTICE "RDS/IB: No client_data for device %s\n", 235 printk(KERN_NOTICE "RDS/IB: No client_data for device %s\n",
236 dev->name); 236 dev->name);
@@ -306,7 +306,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
306 ic->i_send_ring.w_nr * 306 ic->i_send_ring.w_nr *
307 sizeof(struct rds_header), 307 sizeof(struct rds_header),
308 &ic->i_send_hdrs_dma, GFP_KERNEL); 308 &ic->i_send_hdrs_dma, GFP_KERNEL);
309 if (ic->i_send_hdrs == NULL) { 309 if (!ic->i_send_hdrs) {
310 ret = -ENOMEM; 310 ret = -ENOMEM;
311 rdsdebug("ib_dma_alloc_coherent send failed\n"); 311 rdsdebug("ib_dma_alloc_coherent send failed\n");
312 goto out; 312 goto out;
@@ -316,7 +316,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
316 ic->i_recv_ring.w_nr * 316 ic->i_recv_ring.w_nr *
317 sizeof(struct rds_header), 317 sizeof(struct rds_header),
318 &ic->i_recv_hdrs_dma, GFP_KERNEL); 318 &ic->i_recv_hdrs_dma, GFP_KERNEL);
319 if (ic->i_recv_hdrs == NULL) { 319 if (!ic->i_recv_hdrs) {
320 ret = -ENOMEM; 320 ret = -ENOMEM;
321 rdsdebug("ib_dma_alloc_coherent recv failed\n"); 321 rdsdebug("ib_dma_alloc_coherent recv failed\n");
322 goto out; 322 goto out;
@@ -324,14 +324,14 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
324 324
325 ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header), 325 ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header),
326 &ic->i_ack_dma, GFP_KERNEL); 326 &ic->i_ack_dma, GFP_KERNEL);
327 if (ic->i_ack == NULL) { 327 if (!ic->i_ack) {
328 ret = -ENOMEM; 328 ret = -ENOMEM;
329 rdsdebug("ib_dma_alloc_coherent ack failed\n"); 329 rdsdebug("ib_dma_alloc_coherent ack failed\n");
330 goto out; 330 goto out;
331 } 331 }
332 332
333 ic->i_sends = vmalloc(ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work)); 333 ic->i_sends = vmalloc(ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work));
334 if (ic->i_sends == NULL) { 334 if (!ic->i_sends) {
335 ret = -ENOMEM; 335 ret = -ENOMEM;
336 rdsdebug("send allocation failed\n"); 336 rdsdebug("send allocation failed\n");
337 goto out; 337 goto out;
@@ -339,7 +339,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
339 memset(ic->i_sends, 0, ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work)); 339 memset(ic->i_sends, 0, ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work));
340 340
341 ic->i_recvs = vmalloc(ic->i_recv_ring.w_nr * sizeof(struct rds_ib_recv_work)); 341 ic->i_recvs = vmalloc(ic->i_recv_ring.w_nr * sizeof(struct rds_ib_recv_work));
342 if (ic->i_recvs == NULL) { 342 if (!ic->i_recvs) {
343 ret = -ENOMEM; 343 ret = -ENOMEM;
344 rdsdebug("recv allocation failed\n"); 344 rdsdebug("recv allocation failed\n");
345 goto out; 345 goto out;
@@ -693,7 +693,7 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
693 693
694 /* XXX too lazy? */ 694 /* XXX too lazy? */
695 ic = kzalloc(sizeof(struct rds_ib_connection), GFP_KERNEL); 695 ic = kzalloc(sizeof(struct rds_ib_connection), GFP_KERNEL);
696 if (ic == NULL) 696 if (!ic)
697 return -ENOMEM; 697 return -ENOMEM;
698 698
699 INIT_LIST_HEAD(&ic->ib_node); 699 INIT_LIST_HEAD(&ic->ib_node);
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index c74e9904a6b2..d0ee9c114c6c 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -53,7 +53,7 @@ static void rds_ib_frag_drop_page(struct rds_page_frag *frag)
53static void rds_ib_frag_free(struct rds_page_frag *frag) 53static void rds_ib_frag_free(struct rds_page_frag *frag)
54{ 54{
55 rdsdebug("frag %p page %p\n", frag, frag->f_page); 55 rdsdebug("frag %p page %p\n", frag, frag->f_page);
56 BUG_ON(frag->f_page != NULL); 56 BUG_ON(frag->f_page);
57 kmem_cache_free(rds_ib_frag_slab, frag); 57 kmem_cache_free(rds_ib_frag_slab, frag);
58} 58}
59 59
@@ -143,14 +143,14 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,
143 struct ib_sge *sge; 143 struct ib_sge *sge;
144 int ret = -ENOMEM; 144 int ret = -ENOMEM;
145 145
146 if (recv->r_ibinc == NULL) { 146 if (!recv->r_ibinc) {
147 if (!atomic_add_unless(&rds_ib_allocation, 1, rds_ib_sysctl_max_recv_allocation)) { 147 if (!atomic_add_unless(&rds_ib_allocation, 1, rds_ib_sysctl_max_recv_allocation)) {
148 rds_ib_stats_inc(s_ib_rx_alloc_limit); 148 rds_ib_stats_inc(s_ib_rx_alloc_limit);
149 goto out; 149 goto out;
150 } 150 }
151 recv->r_ibinc = kmem_cache_alloc(rds_ib_incoming_slab, 151 recv->r_ibinc = kmem_cache_alloc(rds_ib_incoming_slab,
152 kptr_gfp); 152 kptr_gfp);
153 if (recv->r_ibinc == NULL) { 153 if (!recv->r_ibinc) {
154 atomic_dec(&rds_ib_allocation); 154 atomic_dec(&rds_ib_allocation);
155 goto out; 155 goto out;
156 } 156 }
@@ -158,17 +158,17 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,
158 rds_inc_init(&recv->r_ibinc->ii_inc, conn, conn->c_faddr); 158 rds_inc_init(&recv->r_ibinc->ii_inc, conn, conn->c_faddr);
159 } 159 }
160 160
161 if (recv->r_frag == NULL) { 161 if (!recv->r_frag) {
162 recv->r_frag = kmem_cache_alloc(rds_ib_frag_slab, kptr_gfp); 162 recv->r_frag = kmem_cache_alloc(rds_ib_frag_slab, kptr_gfp);
163 if (recv->r_frag == NULL) 163 if (!recv->r_frag)
164 goto out; 164 goto out;
165 INIT_LIST_HEAD(&recv->r_frag->f_item); 165 INIT_LIST_HEAD(&recv->r_frag->f_item);
166 recv->r_frag->f_page = NULL; 166 recv->r_frag->f_page = NULL;
167 } 167 }
168 168
169 if (ic->i_frag.f_page == NULL) { 169 if (!ic->i_frag.f_page) {
170 ic->i_frag.f_page = alloc_page(page_gfp); 170 ic->i_frag.f_page = alloc_page(page_gfp);
171 if (ic->i_frag.f_page == NULL) 171 if (!ic->i_frag.f_page)
172 goto out; 172 goto out;
173 ic->i_frag.f_offset = 0; 173 ic->i_frag.f_offset = 0;
174 } 174 }
@@ -757,7 +757,7 @@ static void rds_ib_process_recv(struct rds_connection *conn,
757 * into the inc and save the inc so we can hang upcoming fragments 757 * into the inc and save the inc so we can hang upcoming fragments
758 * off its list. 758 * off its list.
759 */ 759 */
760 if (ibinc == NULL) { 760 if (!ibinc) {
761 ibinc = recv->r_ibinc; 761 ibinc = recv->r_ibinc;
762 recv->r_ibinc = NULL; 762 recv->r_ibinc = NULL;
763 ic->i_ibinc = ibinc; 763 ic->i_ibinc = ibinc;
@@ -940,13 +940,13 @@ int __init rds_ib_recv_init(void)
940 rds_ib_incoming_slab = kmem_cache_create("rds_ib_incoming", 940 rds_ib_incoming_slab = kmem_cache_create("rds_ib_incoming",
941 sizeof(struct rds_ib_incoming), 941 sizeof(struct rds_ib_incoming),
942 0, 0, NULL); 942 0, 0, NULL);
943 if (rds_ib_incoming_slab == NULL) 943 if (!rds_ib_incoming_slab)
944 goto out; 944 goto out;
945 945
946 rds_ib_frag_slab = kmem_cache_create("rds_ib_frag", 946 rds_ib_frag_slab = kmem_cache_create("rds_ib_frag",
947 sizeof(struct rds_page_frag), 947 sizeof(struct rds_page_frag),
948 0, 0, NULL); 948 0, 0, NULL);
949 if (rds_ib_frag_slab == NULL) 949 if (!rds_ib_frag_slab)
950 kmem_cache_destroy(rds_ib_incoming_slab); 950 kmem_cache_destroy(rds_ib_incoming_slab);
951 else 951 else
952 ret = 0; 952 ret = 0;
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index 17fa80803ab0..0b0090d2ee01 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -86,7 +86,7 @@ static void rds_ib_send_unmap_rm(struct rds_ib_connection *ic,
86 rm->m_sg, rm->m_nents, 86 rm->m_sg, rm->m_nents,
87 DMA_TO_DEVICE); 87 DMA_TO_DEVICE);
88 88
89 if (rm->m_rdma_op != NULL) { 89 if (rm->m_rdma_op) {
90 rds_ib_send_unmap_rdma(ic, rm->m_rdma_op); 90 rds_ib_send_unmap_rdma(ic, rm->m_rdma_op);
91 91
92 /* If the user asked for a completion notification on this 92 /* If the user asked for a completion notification on this
@@ -525,7 +525,7 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
525 } 525 }
526 526
527 /* map the message the first time we see it */ 527 /* map the message the first time we see it */
528 if (ic->i_rm == NULL) { 528 if (!ic->i_rm) {
529 /* 529 /*
530 printk(KERN_NOTICE "rds_ib_xmit prep msg dport=%u flags=0x%x len=%d\n", 530 printk(KERN_NOTICE "rds_ib_xmit prep msg dport=%u flags=0x%x len=%d\n",
531 be16_to_cpu(rm->m_inc.i_hdr.h_dport), 531 be16_to_cpu(rm->m_inc.i_hdr.h_dport),
diff --git a/net/rds/ib_sysctl.c b/net/rds/ib_sysctl.c
index 03f01cb4e0fe..c070524c4d95 100644
--- a/net/rds/ib_sysctl.c
+++ b/net/rds/ib_sysctl.c
@@ -135,7 +135,7 @@ void rds_ib_sysctl_exit(void)
135int __init rds_ib_sysctl_init(void) 135int __init rds_ib_sysctl_init(void)
136{ 136{
137 rds_ib_sysctl_hdr = register_sysctl_paths(rds_ib_sysctl_path, rds_ib_sysctl_table); 137 rds_ib_sysctl_hdr = register_sysctl_paths(rds_ib_sysctl_path, rds_ib_sysctl_table);
138 if (rds_ib_sysctl_hdr == NULL) 138 if (!rds_ib_sysctl_hdr)
139 return -ENOMEM; 139 return -ENOMEM;
140 return 0; 140 return 0;
141} 141}
diff --git a/net/rds/info.c b/net/rds/info.c
index c45c4173a44d..4fdf1b6e84ff 100644
--- a/net/rds/info.c
+++ b/net/rds/info.c
@@ -76,7 +76,7 @@ void rds_info_register_func(int optname, rds_info_func func)
76 BUG_ON(optname < RDS_INFO_FIRST || optname > RDS_INFO_LAST); 76 BUG_ON(optname < RDS_INFO_FIRST || optname > RDS_INFO_LAST);
77 77
78 spin_lock(&rds_info_lock); 78 spin_lock(&rds_info_lock);
79 BUG_ON(rds_info_funcs[offset] != NULL); 79 BUG_ON(rds_info_funcs[offset]);
80 rds_info_funcs[offset] = func; 80 rds_info_funcs[offset] = func;
81 spin_unlock(&rds_info_lock); 81 spin_unlock(&rds_info_lock);
82} 82}
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(rds_info_deregister_func);
102 */ 102 */
103void rds_info_iter_unmap(struct rds_info_iterator *iter) 103void rds_info_iter_unmap(struct rds_info_iterator *iter)
104{ 104{
105 if (iter->addr != NULL) { 105 if (iter->addr) {
106 kunmap_atomic(iter->addr, KM_USER0); 106 kunmap_atomic(iter->addr, KM_USER0);
107 iter->addr = NULL; 107 iter->addr = NULL;
108 } 108 }
@@ -117,7 +117,7 @@ void rds_info_copy(struct rds_info_iterator *iter, void *data,
117 unsigned long this; 117 unsigned long this;
118 118
119 while (bytes) { 119 while (bytes) {
120 if (iter->addr == NULL) 120 if (!iter->addr)
121 iter->addr = kmap_atomic(*iter->pages, KM_USER0); 121 iter->addr = kmap_atomic(*iter->pages, KM_USER0);
122 122
123 this = min(bytes, PAGE_SIZE - iter->offset); 123 this = min(bytes, PAGE_SIZE - iter->offset);
@@ -188,7 +188,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,
188 >> PAGE_SHIFT; 188 >> PAGE_SHIFT;
189 189
190 pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL); 190 pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
191 if (pages == NULL) { 191 if (!pages) {
192 ret = -ENOMEM; 192 ret = -ENOMEM;
193 goto out; 193 goto out;
194 } 194 }
@@ -206,7 +206,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,
206 206
207call_func: 207call_func:
208 func = rds_info_funcs[optname - RDS_INFO_FIRST]; 208 func = rds_info_funcs[optname - RDS_INFO_FIRST];
209 if (func == NULL) { 209 if (!func) {
210 ret = -ENOPROTOOPT; 210 ret = -ENOPROTOOPT;
211 goto out; 211 goto out;
212 } 212 }
@@ -234,7 +234,7 @@ call_func:
234 ret = -EFAULT; 234 ret = -EFAULT;
235 235
236out: 236out:
237 for (i = 0; pages != NULL && i < nr_pages; i++) 237 for (i = 0; pages && i < nr_pages; i++)
238 put_page(pages[i]); 238 put_page(pages[i]);
239 kfree(pages); 239 kfree(pages);
240 240
diff --git a/net/rds/iw_cm.c b/net/rds/iw_cm.c
index b5dd6ac39be8..712cf2d1f28e 100644
--- a/net/rds/iw_cm.c
+++ b/net/rds/iw_cm.c
@@ -257,7 +257,7 @@ static int rds_iw_setup_qp(struct rds_connection *conn)
257 * the rds_iwdev at all. 257 * the rds_iwdev at all.
258 */ 258 */
259 rds_iwdev = ib_get_client_data(dev, &rds_iw_client); 259 rds_iwdev = ib_get_client_data(dev, &rds_iw_client);
260 if (rds_iwdev == NULL) { 260 if (!rds_iwdev) {
261 if (printk_ratelimit()) 261 if (printk_ratelimit())
262 printk(KERN_NOTICE "RDS/IW: No client_data for device %s\n", 262 printk(KERN_NOTICE "RDS/IW: No client_data for device %s\n",
263 dev->name); 263 dev->name);
@@ -292,7 +292,7 @@ static int rds_iw_setup_qp(struct rds_connection *conn)
292 ic->i_send_ring.w_nr * 292 ic->i_send_ring.w_nr *
293 sizeof(struct rds_header), 293 sizeof(struct rds_header),
294 &ic->i_send_hdrs_dma, GFP_KERNEL); 294 &ic->i_send_hdrs_dma, GFP_KERNEL);
295 if (ic->i_send_hdrs == NULL) { 295 if (!ic->i_send_hdrs) {
296 ret = -ENOMEM; 296 ret = -ENOMEM;
297 rdsdebug("ib_dma_alloc_coherent send failed\n"); 297 rdsdebug("ib_dma_alloc_coherent send failed\n");
298 goto out; 298 goto out;
@@ -302,7 +302,7 @@ static int rds_iw_setup_qp(struct rds_connection *conn)
302 ic->i_recv_ring.w_nr * 302 ic->i_recv_ring.w_nr *
303 sizeof(struct rds_header), 303 sizeof(struct rds_header),
304 &ic->i_recv_hdrs_dma, GFP_KERNEL); 304 &ic->i_recv_hdrs_dma, GFP_KERNEL);
305 if (ic->i_recv_hdrs == NULL) { 305 if (!ic->i_recv_hdrs) {
306 ret = -ENOMEM; 306 ret = -ENOMEM;
307 rdsdebug("ib_dma_alloc_coherent recv failed\n"); 307 rdsdebug("ib_dma_alloc_coherent recv failed\n");
308 goto out; 308 goto out;
@@ -310,14 +310,14 @@ static int rds_iw_setup_qp(struct rds_connection *conn)
310 310
311 ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header), 311 ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header),
312 &ic->i_ack_dma, GFP_KERNEL); 312 &ic->i_ack_dma, GFP_KERNEL);
313 if (ic->i_ack == NULL) { 313 if (!ic->i_ack) {
314 ret = -ENOMEM; 314 ret = -ENOMEM;
315 rdsdebug("ib_dma_alloc_coherent ack failed\n"); 315 rdsdebug("ib_dma_alloc_coherent ack failed\n");
316 goto out; 316 goto out;
317 } 317 }
318 318
319 ic->i_sends = vmalloc(ic->i_send_ring.w_nr * sizeof(struct rds_iw_send_work)); 319 ic->i_sends = vmalloc(ic->i_send_ring.w_nr * sizeof(struct rds_iw_send_work));
320 if (ic->i_sends == NULL) { 320 if (!ic->i_sends) {
321 ret = -ENOMEM; 321 ret = -ENOMEM;
322 rdsdebug("send allocation failed\n"); 322 rdsdebug("send allocation failed\n");
323 goto out; 323 goto out;
@@ -325,7 +325,7 @@ static int rds_iw_setup_qp(struct rds_connection *conn)
325 rds_iw_send_init_ring(ic); 325 rds_iw_send_init_ring(ic);
326 326
327 ic->i_recvs = vmalloc(ic->i_recv_ring.w_nr * sizeof(struct rds_iw_recv_work)); 327 ic->i_recvs = vmalloc(ic->i_recv_ring.w_nr * sizeof(struct rds_iw_recv_work));
328 if (ic->i_recvs == NULL) { 328 if (!ic->i_recvs) {
329 ret = -ENOMEM; 329 ret = -ENOMEM;
330 rdsdebug("recv allocation failed\n"); 330 rdsdebug("recv allocation failed\n");
331 goto out; 331 goto out;
@@ -696,7 +696,7 @@ int rds_iw_conn_alloc(struct rds_connection *conn, gfp_t gfp)
696 696
697 /* XXX too lazy? */ 697 /* XXX too lazy? */
698 ic = kzalloc(sizeof(struct rds_iw_connection), GFP_KERNEL); 698 ic = kzalloc(sizeof(struct rds_iw_connection), GFP_KERNEL);
699 if (ic == NULL) 699 if (!ic)
700 return -ENOMEM; 700 return -ENOMEM;
701 701
702 INIT_LIST_HEAD(&ic->iw_node); 702 INIT_LIST_HEAD(&ic->iw_node);
diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c
index 3d479067d54d..48bcf4f2bf3c 100644
--- a/net/rds/iw_recv.c
+++ b/net/rds/iw_recv.c
@@ -53,7 +53,7 @@ static void rds_iw_frag_drop_page(struct rds_page_frag *frag)
53static void rds_iw_frag_free(struct rds_page_frag *frag) 53static void rds_iw_frag_free(struct rds_page_frag *frag)
54{ 54{
55 rdsdebug("frag %p page %p\n", frag, frag->f_page); 55 rdsdebug("frag %p page %p\n", frag, frag->f_page);
56 BUG_ON(frag->f_page != NULL); 56 BUG_ON(frag->f_page);
57 kmem_cache_free(rds_iw_frag_slab, frag); 57 kmem_cache_free(rds_iw_frag_slab, frag);
58} 58}
59 59
@@ -143,14 +143,14 @@ static int rds_iw_recv_refill_one(struct rds_connection *conn,
143 struct ib_sge *sge; 143 struct ib_sge *sge;
144 int ret = -ENOMEM; 144 int ret = -ENOMEM;
145 145
146 if (recv->r_iwinc == NULL) { 146 if (!recv->r_iwinc) {
147 if (!atomic_add_unless(&rds_iw_allocation, 1, rds_iw_sysctl_max_recv_allocation)) { 147 if (!atomic_add_unless(&rds_iw_allocation, 1, rds_iw_sysctl_max_recv_allocation)) {
148 rds_iw_stats_inc(s_iw_rx_alloc_limit); 148 rds_iw_stats_inc(s_iw_rx_alloc_limit);
149 goto out; 149 goto out;
150 } 150 }
151 recv->r_iwinc = kmem_cache_alloc(rds_iw_incoming_slab, 151 recv->r_iwinc = kmem_cache_alloc(rds_iw_incoming_slab,
152 kptr_gfp); 152 kptr_gfp);
153 if (recv->r_iwinc == NULL) { 153 if (!recv->r_iwinc) {
154 atomic_dec(&rds_iw_allocation); 154 atomic_dec(&rds_iw_allocation);
155 goto out; 155 goto out;
156 } 156 }
@@ -158,17 +158,17 @@ static int rds_iw_recv_refill_one(struct rds_connection *conn,
158 rds_inc_init(&recv->r_iwinc->ii_inc, conn, conn->c_faddr); 158 rds_inc_init(&recv->r_iwinc->ii_inc, conn, conn->c_faddr);
159 } 159 }
160 160
161 if (recv->r_frag == NULL) { 161 if (!recv->r_frag) {
162 recv->r_frag = kmem_cache_alloc(rds_iw_frag_slab, kptr_gfp); 162 recv->r_frag = kmem_cache_alloc(rds_iw_frag_slab, kptr_gfp);
163 if (recv->r_frag == NULL) 163 if (!recv->r_frag)
164 goto out; 164 goto out;
165 INIT_LIST_HEAD(&recv->r_frag->f_item); 165 INIT_LIST_HEAD(&recv->r_frag->f_item);
166 recv->r_frag->f_page = NULL; 166 recv->r_frag->f_page = NULL;
167 } 167 }
168 168
169 if (ic->i_frag.f_page == NULL) { 169 if (!ic->i_frag.f_page) {
170 ic->i_frag.f_page = alloc_page(page_gfp); 170 ic->i_frag.f_page = alloc_page(page_gfp);
171 if (ic->i_frag.f_page == NULL) 171 if (!ic->i_frag.f_page)
172 goto out; 172 goto out;
173 ic->i_frag.f_offset = 0; 173 ic->i_frag.f_offset = 0;
174 } 174 }
@@ -716,7 +716,7 @@ static void rds_iw_process_recv(struct rds_connection *conn,
716 * into the inc and save the inc so we can hang upcoming fragments 716 * into the inc and save the inc so we can hang upcoming fragments
717 * off its list. 717 * off its list.
718 */ 718 */
719 if (iwinc == NULL) { 719 if (!iwinc) {
720 iwinc = recv->r_iwinc; 720 iwinc = recv->r_iwinc;
721 recv->r_iwinc = NULL; 721 recv->r_iwinc = NULL;
722 ic->i_iwinc = iwinc; 722 ic->i_iwinc = iwinc;
@@ -899,13 +899,13 @@ int __init rds_iw_recv_init(void)
899 rds_iw_incoming_slab = kmem_cache_create("rds_iw_incoming", 899 rds_iw_incoming_slab = kmem_cache_create("rds_iw_incoming",
900 sizeof(struct rds_iw_incoming), 900 sizeof(struct rds_iw_incoming),
901 0, 0, NULL); 901 0, 0, NULL);
902 if (rds_iw_incoming_slab == NULL) 902 if (!rds_iw_incoming_slab)
903 goto out; 903 goto out;
904 904
905 rds_iw_frag_slab = kmem_cache_create("rds_iw_frag", 905 rds_iw_frag_slab = kmem_cache_create("rds_iw_frag",
906 sizeof(struct rds_page_frag), 906 sizeof(struct rds_page_frag),
907 0, 0, NULL); 907 0, 0, NULL);
908 if (rds_iw_frag_slab == NULL) 908 if (!rds_iw_frag_slab)
909 kmem_cache_destroy(rds_iw_incoming_slab); 909 kmem_cache_destroy(rds_iw_incoming_slab);
910 else 910 else
911 ret = 0; 911 ret = 0;
diff --git a/net/rds/iw_send.c b/net/rds/iw_send.c
index 52182ff7519e..dced532f9cfb 100644
--- a/net/rds/iw_send.c
+++ b/net/rds/iw_send.c
@@ -86,7 +86,7 @@ static void rds_iw_send_unmap_rm(struct rds_iw_connection *ic,
86 rm->m_sg, rm->m_nents, 86 rm->m_sg, rm->m_nents,
87 DMA_TO_DEVICE); 87 DMA_TO_DEVICE);
88 88
89 if (rm->m_rdma_op != NULL) { 89 if (rm->m_rdma_op) {
90 rds_iw_send_unmap_rdma(ic, rm->m_rdma_op); 90 rds_iw_send_unmap_rdma(ic, rm->m_rdma_op);
91 91
92 /* If the user asked for a completion notification on this 92 /* If the user asked for a completion notification on this
@@ -556,7 +556,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,
556 } 556 }
557 557
558 /* map the message the first time we see it */ 558 /* map the message the first time we see it */
559 if (ic->i_rm == NULL) { 559 if (!ic->i_rm) {
560 /* 560 /*
561 printk(KERN_NOTICE "rds_iw_xmit prep msg dport=%u flags=0x%x len=%d\n", 561 printk(KERN_NOTICE "rds_iw_xmit prep msg dport=%u flags=0x%x len=%d\n",
562 be16_to_cpu(rm->m_inc.i_hdr.h_dport), 562 be16_to_cpu(rm->m_inc.i_hdr.h_dport),
diff --git a/net/rds/iw_sysctl.c b/net/rds/iw_sysctl.c
index 1c4428a61a02..3cb0587d6f50 100644
--- a/net/rds/iw_sysctl.c
+++ b/net/rds/iw_sysctl.c
@@ -125,7 +125,7 @@ void rds_iw_sysctl_exit(void)
125int __init rds_iw_sysctl_init(void) 125int __init rds_iw_sysctl_init(void)
126{ 126{
127 rds_iw_sysctl_hdr = register_sysctl_paths(rds_iw_sysctl_path, rds_iw_sysctl_table); 127 rds_iw_sysctl_hdr = register_sysctl_paths(rds_iw_sysctl_path, rds_iw_sysctl_table);
128 if (rds_iw_sysctl_hdr == NULL) 128 if (!rds_iw_sysctl_hdr)
129 return -ENOMEM; 129 return -ENOMEM;
130 return 0; 130 return 0;
131} 131}
diff --git a/net/rds/loop.c b/net/rds/loop.c
index dd9879379457..a74b469a844a 100644
--- a/net/rds/loop.c
+++ b/net/rds/loop.c
@@ -112,7 +112,7 @@ static int rds_loop_conn_alloc(struct rds_connection *conn, gfp_t gfp)
112 unsigned long flags; 112 unsigned long flags;
113 113
114 lc = kzalloc(sizeof(struct rds_loop_connection), GFP_KERNEL); 114 lc = kzalloc(sizeof(struct rds_loop_connection), GFP_KERNEL);
115 if (lc == NULL) 115 if (!lc)
116 return -ENOMEM; 116 return -ENOMEM;
117 117
118 INIT_LIST_HEAD(&lc->loop_node); 118 INIT_LIST_HEAD(&lc->loop_node);
diff --git a/net/rds/message.c b/net/rds/message.c
index 9a1d67e001ba..809656c2b25c 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -240,7 +240,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
240 unsigned int i; 240 unsigned int i;
241 241
242 rm = rds_message_alloc(ceil(total_len, PAGE_SIZE), GFP_KERNEL); 242 rm = rds_message_alloc(ceil(total_len, PAGE_SIZE), GFP_KERNEL);
243 if (rm == NULL) 243 if (!rm)
244 return ERR_PTR(-ENOMEM); 244 return ERR_PTR(-ENOMEM);
245 245
246 set_bit(RDS_MSG_PAGEVEC, &rm->m_flags); 246 set_bit(RDS_MSG_PAGEVEC, &rm->m_flags);
@@ -284,7 +284,7 @@ struct rds_message *rds_message_copy_from_user(struct iovec *first_iov,
284 sg_off = 0; /* Dear gcc, sg->page will be null from kzalloc. */ 284 sg_off = 0; /* Dear gcc, sg->page will be null from kzalloc. */
285 285
286 while (total_len) { 286 while (total_len) {
287 if (sg_page(sg) == NULL) { 287 if (!sg_page(sg)) {
288 ret = rds_page_remainder_alloc(sg, total_len, 288 ret = rds_page_remainder_alloc(sg, total_len,
289 GFP_HIGHUSER); 289 GFP_HIGHUSER);
290 if (ret) 290 if (ret)
diff --git a/net/rds/page.c b/net/rds/page.c
index 595a952d4b17..e5b2527ae257 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -116,7 +116,7 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
116 /* jump straight to allocation if we're trying for a huge page */ 116 /* jump straight to allocation if we're trying for a huge page */
117 if (bytes >= PAGE_SIZE) { 117 if (bytes >= PAGE_SIZE) {
118 page = alloc_page(gfp); 118 page = alloc_page(gfp);
119 if (page == NULL) { 119 if (!page) {
120 ret = -ENOMEM; 120 ret = -ENOMEM;
121 } else { 121 } else {
122 sg_set_page(scat, page, PAGE_SIZE, 0); 122 sg_set_page(scat, page, PAGE_SIZE, 0);
@@ -162,7 +162,7 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
162 rem = &per_cpu(rds_page_remainders, get_cpu()); 162 rem = &per_cpu(rds_page_remainders, get_cpu());
163 local_irq_save(flags); 163 local_irq_save(flags);
164 164
165 if (page == NULL) { 165 if (!page) {
166 ret = -ENOMEM; 166 ret = -ENOMEM;
167 break; 167 break;
168 } 168 }
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index 463b458ff27e..dee698b979af 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -189,7 +189,7 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
189 goto out; 189 goto out;
190 } 190 }
191 191
192 if (rs->rs_transport->get_mr == NULL) { 192 if (!rs->rs_transport->get_mr) {
193 ret = -EOPNOTSUPP; 193 ret = -EOPNOTSUPP;
194 goto out; 194 goto out;
195 } 195 }
@@ -205,13 +205,13 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
205 205
206 /* XXX clamp nr_pages to limit the size of this alloc? */ 206 /* XXX clamp nr_pages to limit the size of this alloc? */
207 pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); 207 pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
208 if (pages == NULL) { 208 if (!pages) {
209 ret = -ENOMEM; 209 ret = -ENOMEM;
210 goto out; 210 goto out;
211 } 211 }
212 212
213 mr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL); 213 mr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL);
214 if (mr == NULL) { 214 if (!mr) {
215 ret = -ENOMEM; 215 ret = -ENOMEM;
216 goto out; 216 goto out;
217 } 217 }
@@ -244,7 +244,7 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
244 244
245 nents = ret; 245 nents = ret;
246 sg = kcalloc(nents, sizeof(*sg), GFP_KERNEL); 246 sg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);
247 if (sg == NULL) { 247 if (!sg) {
248 ret = -ENOMEM; 248 ret = -ENOMEM;
249 goto out; 249 goto out;
250 } 250 }
@@ -425,7 +425,7 @@ void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force)
425 /* May have to issue a dma_sync on this memory region. 425 /* May have to issue a dma_sync on this memory region.
426 * Note we could avoid this if the operation was a RDMA READ, 426 * Note we could avoid this if the operation was a RDMA READ,
427 * but at this point we can't tell. */ 427 * but at this point we can't tell. */
428 if (mr != NULL) { 428 if (mr) {
429 if (mr->r_trans->sync_mr) 429 if (mr->r_trans->sync_mr)
430 mr->r_trans->sync_mr(mr->r_trans_private, DMA_FROM_DEVICE); 430 mr->r_trans->sync_mr(mr->r_trans_private, DMA_FROM_DEVICE);
431 431
@@ -511,13 +511,13 @@ static struct rds_rdma_op *rds_rdma_prepare(struct rds_sock *rs,
511 } 511 }
512 512
513 pages = kcalloc(max_pages, sizeof(struct page *), GFP_KERNEL); 513 pages = kcalloc(max_pages, sizeof(struct page *), GFP_KERNEL);
514 if (pages == NULL) { 514 if (!pages) {
515 ret = -ENOMEM; 515 ret = -ENOMEM;
516 goto out; 516 goto out;
517 } 517 }
518 518
519 op = kzalloc(offsetof(struct rds_rdma_op, r_sg[nr_pages]), GFP_KERNEL); 519 op = kzalloc(offsetof(struct rds_rdma_op, r_sg[nr_pages]), GFP_KERNEL);
520 if (op == NULL) { 520 if (!op) {
521 ret = -ENOMEM; 521 ret = -ENOMEM;
522 goto out; 522 goto out;
523 } 523 }
@@ -643,7 +643,7 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
643 struct rds_rdma_op *op; 643 struct rds_rdma_op *op;
644 644
645 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_rdma_args)) || 645 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_rdma_args)) ||
646 rm->m_rdma_op != NULL) 646 rm->m_rdma_op)
647 return -EINVAL; 647 return -EINVAL;
648 648
649 op = rds_rdma_prepare(rs, CMSG_DATA(cmsg)); 649 op = rds_rdma_prepare(rs, CMSG_DATA(cmsg));
@@ -681,7 +681,7 @@ int rds_cmsg_rdma_dest(struct rds_sock *rs, struct rds_message *rm,
681 681
682 spin_lock_irqsave(&rs->rs_rdma_lock, flags); 682 spin_lock_irqsave(&rs->rs_rdma_lock, flags);
683 mr = rds_mr_tree_walk(&rs->rs_rdma_keys, r_key, NULL); 683 mr = rds_mr_tree_walk(&rs->rs_rdma_keys, r_key, NULL);
684 if (mr == NULL) 684 if (!mr)
685 err = -EINVAL; /* invalid r_key */ 685 err = -EINVAL; /* invalid r_key */
686 else 686 else
687 atomic_inc(&mr->r_refcount); 687 atomic_inc(&mr->r_refcount);
diff --git a/net/rds/recv.c b/net/rds/recv.c
index c93588c2d553..88f1f5aecfa6 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -210,7 +210,7 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 saddr, __be32 daddr,
210 } 210 }
211 211
212 rs = rds_find_bound(daddr, inc->i_hdr.h_dport); 212 rs = rds_find_bound(daddr, inc->i_hdr.h_dport);
213 if (rs == NULL) { 213 if (!rs) {
214 rds_stats_inc(s_recv_drop_no_sock); 214 rds_stats_inc(s_recv_drop_no_sock);
215 goto out; 215 goto out;
216 } 216 }
@@ -251,7 +251,7 @@ static int rds_next_incoming(struct rds_sock *rs, struct rds_incoming **inc)
251{ 251{
252 unsigned long flags; 252 unsigned long flags;
253 253
254 if (*inc == NULL) { 254 if (!*inc) {
255 read_lock_irqsave(&rs->rs_recv_lock, flags); 255 read_lock_irqsave(&rs->rs_recv_lock, flags);
256 if (!list_empty(&rs->rs_recv_queue)) { 256 if (!list_empty(&rs->rs_recv_queue)) {
257 *inc = list_entry(rs->rs_recv_queue.next, 257 *inc = list_entry(rs->rs_recv_queue.next,
diff --git a/net/rds/send.c b/net/rds/send.c
index 725fb0419797..817997daf785 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -164,7 +164,7 @@ int rds_send_xmit(struct rds_connection *conn)
164 * offset and S/G temporaries. 164 * offset and S/G temporaries.
165 */ 165 */
166 rm = conn->c_xmit_rm; 166 rm = conn->c_xmit_rm;
167 if (rm != NULL && 167 if (rm &&
168 conn->c_xmit_hdr_off == sizeof(struct rds_header) && 168 conn->c_xmit_hdr_off == sizeof(struct rds_header) &&
169 conn->c_xmit_sg == rm->m_nents) { 169 conn->c_xmit_sg == rm->m_nents) {
170 conn->c_xmit_rm = NULL; 170 conn->c_xmit_rm = NULL;
@@ -180,8 +180,8 @@ int rds_send_xmit(struct rds_connection *conn)
180 180
181 /* If we're asked to send a cong map update, do so. 181 /* If we're asked to send a cong map update, do so.
182 */ 182 */
183 if (rm == NULL && test_and_clear_bit(0, &conn->c_map_queued)) { 183 if (!rm && test_and_clear_bit(0, &conn->c_map_queued)) {
184 if (conn->c_trans->xmit_cong_map != NULL) { 184 if (conn->c_trans->xmit_cong_map) {
185 conn->c_map_offset = 0; 185 conn->c_map_offset = 0;
186 conn->c_map_bytes = sizeof(struct rds_header) + 186 conn->c_map_bytes = sizeof(struct rds_header) +
187 RDS_CONG_MAP_BYTES; 187 RDS_CONG_MAP_BYTES;
@@ -204,7 +204,7 @@ int rds_send_xmit(struct rds_connection *conn)
204 * the connction. We can use this ref while holding the 204 * the connction. We can use this ref while holding the
205 * send_sem.. rds_send_reset() is serialized with it. 205 * send_sem.. rds_send_reset() is serialized with it.
206 */ 206 */
207 if (rm == NULL) { 207 if (!rm) {
208 unsigned int len; 208 unsigned int len;
209 209
210 spin_lock_irqsave(&conn->c_lock, flags); 210 spin_lock_irqsave(&conn->c_lock, flags);
@@ -224,7 +224,7 @@ int rds_send_xmit(struct rds_connection *conn)
224 224
225 spin_unlock_irqrestore(&conn->c_lock, flags); 225 spin_unlock_irqrestore(&conn->c_lock, flags);
226 226
227 if (rm == NULL) { 227 if (!rm) {
228 was_empty = 1; 228 was_empty = 1;
229 break; 229 break;
230 } 230 }
@@ -875,7 +875,7 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
875 goto out; 875 goto out;
876 876
877 if ((rm->m_rdma_cookie || rm->m_rdma_op) && 877 if ((rm->m_rdma_cookie || rm->m_rdma_op) &&
878 conn->c_trans->xmit_rdma == NULL) { 878 !conn->c_trans->xmit_rdma) {
879 if (printk_ratelimit()) 879 if (printk_ratelimit())
880 printk(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n", 880 printk(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n",
881 rm->m_rdma_op, conn->c_trans->xmit_rdma); 881 rm->m_rdma_op, conn->c_trans->xmit_rdma);
@@ -961,7 +961,7 @@ rds_send_pong(struct rds_connection *conn, __be16 dport)
961 int ret = 0; 961 int ret = 0;
962 962
963 rm = rds_message_alloc(0, GFP_ATOMIC); 963 rm = rds_message_alloc(0, GFP_ATOMIC);
964 if (rm == NULL) { 964 if (!rm) {
965 ret = -ENOMEM; 965 ret = -ENOMEM;
966 goto out; 966 goto out;
967 } 967 }
diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
index 7829a20325d3..5a6dd81de188 100644
--- a/net/rds/sysctl.c
+++ b/net/rds/sysctl.c
@@ -111,7 +111,7 @@ int __init rds_sysctl_init(void)
111 rds_sysctl_reconnect_min_jiffies = rds_sysctl_reconnect_min; 111 rds_sysctl_reconnect_min_jiffies = rds_sysctl_reconnect_min;
112 112
113 rds_sysctl_reg_table = register_sysctl_paths(rds_sysctl_path, rds_sysctl_rds_table); 113 rds_sysctl_reg_table = register_sysctl_paths(rds_sysctl_path, rds_sysctl_rds_table);
114 if (rds_sysctl_reg_table == NULL) 114 if (!rds_sysctl_reg_table)
115 return -ENOMEM; 115 return -ENOMEM;
116 return 0; 116 return 0;
117} 117}
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index babf4577ff7d..aebe10314fdb 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -200,7 +200,7 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp)
200 struct rds_tcp_connection *tc; 200 struct rds_tcp_connection *tc;
201 201
202 tc = kmem_cache_alloc(rds_tcp_conn_slab, gfp); 202 tc = kmem_cache_alloc(rds_tcp_conn_slab, gfp);
203 if (tc == NULL) 203 if (!tc)
204 return -ENOMEM; 204 return -ENOMEM;
205 205
206 tc->t_sock = NULL; 206 tc->t_sock = NULL;
@@ -283,7 +283,7 @@ int __init rds_tcp_init(void)
283 rds_tcp_conn_slab = kmem_cache_create("rds_tcp_connection", 283 rds_tcp_conn_slab = kmem_cache_create("rds_tcp_connection",
284 sizeof(struct rds_tcp_connection), 284 sizeof(struct rds_tcp_connection),
285 0, 0, NULL); 285 0, 0, NULL);
286 if (rds_tcp_conn_slab == NULL) { 286 if (!rds_tcp_conn_slab) {
287 ret = -ENOMEM; 287 ret = -ENOMEM;
288 goto out; 288 goto out;
289 } 289 }
diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c
index c397524c039c..a65ee78db0c5 100644
--- a/net/rds/tcp_connect.c
+++ b/net/rds/tcp_connect.c
@@ -45,7 +45,7 @@ void rds_tcp_state_change(struct sock *sk)
45 45
46 read_lock(&sk->sk_callback_lock); 46 read_lock(&sk->sk_callback_lock);
47 conn = sk->sk_user_data; 47 conn = sk->sk_user_data;
48 if (conn == NULL) { 48 if (!conn) {
49 state_change = sk->sk_state_change; 49 state_change = sk->sk_state_change;
50 goto out; 50 goto out;
51 } 51 }
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 975183fe6950..50b649eb6933 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -116,7 +116,7 @@ void rds_tcp_listen_data_ready(struct sock *sk, int bytes)
116 116
117 read_lock(&sk->sk_callback_lock); 117 read_lock(&sk->sk_callback_lock);
118 ready = sk->sk_user_data; 118 ready = sk->sk_user_data;
119 if (ready == NULL) { /* check for teardown race */ 119 if (!ready) { /* check for teardown race */
120 ready = sk->sk_data_ready; 120 ready = sk->sk_data_ready;
121 goto out; 121 goto out;
122 } 122 }
@@ -178,7 +178,7 @@ void rds_tcp_listen_stop(void)
178 struct socket *sock = rds_tcp_listen_sock; 178 struct socket *sock = rds_tcp_listen_sock;
179 struct sock *sk; 179 struct sock *sk;
180 180
181 if (sock == NULL) 181 if (!sock)
182 return; 182 return;
183 183
184 sk = sock->sk; 184 sk = sock->sk;
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index 1aba6878fa5d..ea7382908aa5 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -190,10 +190,10 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
190 * processing. 190 * processing.
191 */ 191 */
192 while (left) { 192 while (left) {
193 if (tinc == NULL) { 193 if (!tinc) {
194 tinc = kmem_cache_alloc(rds_tcp_incoming_slab, 194 tinc = kmem_cache_alloc(rds_tcp_incoming_slab,
195 arg->gfp); 195 arg->gfp);
196 if (tinc == NULL) { 196 if (!tinc) {
197 desc->error = -ENOMEM; 197 desc->error = -ENOMEM;
198 goto out; 198 goto out;
199 } 199 }
@@ -229,7 +229,7 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
229 229
230 if (left && tc->t_tinc_data_rem) { 230 if (left && tc->t_tinc_data_rem) {
231 clone = skb_clone(skb, arg->gfp); 231 clone = skb_clone(skb, arg->gfp);
232 if (clone == NULL) { 232 if (!clone) {
233 desc->error = -ENOMEM; 233 desc->error = -ENOMEM;
234 goto out; 234 goto out;
235 } 235 }
@@ -326,7 +326,7 @@ void rds_tcp_data_ready(struct sock *sk, int bytes)
326 326
327 read_lock(&sk->sk_callback_lock); 327 read_lock(&sk->sk_callback_lock);
328 conn = sk->sk_user_data; 328 conn = sk->sk_user_data;
329 if (conn == NULL) { /* check for teardown race */ 329 if (!conn) { /* check for teardown race */
330 ready = sk->sk_data_ready; 330 ready = sk->sk_data_ready;
331 goto out; 331 goto out;
332 } 332 }
@@ -347,7 +347,7 @@ int __init rds_tcp_recv_init(void)
347 rds_tcp_incoming_slab = kmem_cache_create("rds_tcp_incoming", 347 rds_tcp_incoming_slab = kmem_cache_create("rds_tcp_incoming",
348 sizeof(struct rds_tcp_incoming), 348 sizeof(struct rds_tcp_incoming),
349 0, 0, NULL); 349 0, 0, NULL);
350 if (rds_tcp_incoming_slab == NULL) 350 if (!rds_tcp_incoming_slab)
351 return -ENOMEM; 351 return -ENOMEM;
352 return 0; 352 return 0;
353} 353}
diff --git a/net/rds/tcp_send.c b/net/rds/tcp_send.c
index a28b895ff0d1..e5f6ccef79ef 100644
--- a/net/rds/tcp_send.c
+++ b/net/rds/tcp_send.c
@@ -226,7 +226,7 @@ void rds_tcp_write_space(struct sock *sk)
226 226
227 read_lock(&sk->sk_callback_lock); 227 read_lock(&sk->sk_callback_lock);
228 conn = sk->sk_user_data; 228 conn = sk->sk_user_data;
229 if (conn == NULL) { 229 if (!conn) {
230 write_space = sk->sk_write_space; 230 write_space = sk->sk_write_space;
231 goto out; 231 goto out;
232 } 232 }
diff --git a/net/rds/threads.c b/net/rds/threads.c
index 6e2e43d5f576..7a8ca7a1d983 100644
--- a/net/rds/threads.c
+++ b/net/rds/threads.c
@@ -215,7 +215,7 @@ void rds_threads_exit(void)
215int __init rds_threads_init(void) 215int __init rds_threads_init(void)
216{ 216{
217 rds_wq = create_workqueue("krdsd"); 217 rds_wq = create_workqueue("krdsd");
218 if (rds_wq == NULL) 218 if (!rds_wq)
219 return -ENOMEM; 219 return -ENOMEM;
220 220
221 return 0; 221 return 0;