aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/rdma.c
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/rdma.c
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/rdma.c')
-rw-r--r--net/rds/rdma.c18
1 files changed, 9 insertions, 9 deletions
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);