diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2007-06-08 19:29:43 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-09 19:17:33 -0400 |
commit | 1d3f4b905a786d69103d9e6d8e92683fb2c7a027 (patch) | |
tree | ddb38919eadaf8aff6b59240e0a49f3e85baadc4 /drivers/infiniband/core | |
parent | 43506d954e43933cd6fdcab679f6ab057e7607c6 (diff) |
IB: Fix ib_umem_get() when npages == 0
gcc correctly warned:
drivers/infiniband/core/umem.c: In function 'ib_umem_get':
drivers/infiniband/core/umem.c:78: warning: 'ret' may be used uninitialized in this function
Set ret to 0 in case npages == 0 and the loop isn't entered at all.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/umem.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index d40652a80151..26d0470eef6e 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -121,6 +121,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, | |||
121 | 121 | ||
122 | cur_base = addr & PAGE_MASK; | 122 | cur_base = addr & PAGE_MASK; |
123 | 123 | ||
124 | ret = 0; | ||
124 | while (npages) { | 125 | while (npages) { |
125 | ret = get_user_pages(current, current->mm, cur_base, | 126 | ret = get_user_pages(current, current->mm, cur_base, |
126 | min_t(int, npages, | 127 | min_t(int, npages, |