[PATCH 6/9] RDS: Fix ordering in a conditional

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andy Grover
Date: Monday, March 30, 2009 - 11:44 am

Putting the constant first is a supposed "best practice" that actually makes
the code harder to read.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
---
 net/rds/rdma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index eaeeb91..584eac3 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -155,7 +155,7 @@ static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages,
 			     nr_pages, write, 0, pages, NULL);
 	up_read(&current->mm->mmap_sem);
 
-	if (0 <= ret && (unsigned) ret < nr_pages) {
+	if (ret > 0 && (unsigned) ret < nr_pages) {
 		while (ret--)
 			put_page(pages[ret]);
 		ret = -EFAULT;
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/9] RDS updates, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 1/9] RDS: Fix m_rs_lock deadlock, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 6/9] RDS: Fix ordering in a conditional, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 8/9] RDS: Rewrite connection cleanup, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 9/9] RDS: use get_user_pages_fast(), Andy Grover, (Mon Mar 30, 11:44 am)
Re: [PATCH 6/9] RDS: Fix ordering in a conditional, Roland Dreier, (Mon Mar 30, 9:27 pm)
Re: [PATCH 6/9] RDS: Fix ordering in a conditional, Andrew Grover, (Mon Mar 30, 11:56 pm)
Re: [PATCH 6/9] RDS: Fix ordering in a conditional, David Miller, (Tue Mar 31, 2:50 pm)