aboutsummaryrefslogtreecommitdiff
path: root/net/rds/info.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/rds/info.c')
-rw-r--r--net/rds/info.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/net/rds/info.c b/net/rds/info.c
index 814a91a6f4a..9a6b4f66187 100644
--- a/net/rds/info.c
+++ b/net/rds/info.c
@@ -32,7 +32,9 @@
*/
#include <linux/percpu.h>
#include <linux/seq_file.h>
+#include <linux/slab.h>
#include <linux/proc_fs.h>
+#include <linux/export.h>
#include "rds.h"
@@ -75,7 +77,7 @@ void rds_info_register_func(int optname, rds_info_func func)
BUG_ON(optname < RDS_INFO_FIRST || optname > RDS_INFO_LAST);
spin_lock(&rds_info_lock);
- BUG_ON(rds_info_funcs[offset] != NULL);
+ BUG_ON(rds_info_funcs[offset]);
rds_info_funcs[offset] = func;
spin_unlock(&rds_info_lock);
}
@@ -101,8 +103,8 @@ EXPORT_SYMBOL_GPL(rds_info_deregister_func);
*/
void rds_info_iter_unmap(struct rds_info_iterator *iter)
{
- if (iter->addr != NULL) {
- kunmap_atomic(iter->addr, KM_USER0);
+ if (iter->addr) {
+ kunmap_atomic(iter->addr);
iter->addr = NULL;
}
}
@@ -116,8 +118,8 @@ void rds_info_copy(struct rds_info_iterator *iter, void *data,
unsigned long this;
while (bytes) {
- if (iter->addr == NULL)
- iter->addr = kmap_atomic(*iter->pages, KM_USER0);
+ if (!iter->addr)
+ iter->addr = kmap_atomic(*iter->pages);
this = min(bytes, PAGE_SIZE - iter->offset);
@@ -132,7 +134,7 @@ void rds_info_copy(struct rds_info_iterator *iter, void *data,
iter->offset += this;
if (iter->offset == PAGE_SIZE) {
- kunmap_atomic(iter->addr, KM_USER0);
+ kunmap_atomic(iter->addr);
iter->addr = NULL;
iter->offset = 0;
iter->pages++;
@@ -187,7 +189,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,
>> PAGE_SHIFT;
pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
- if (pages == NULL) {
+ if (!pages) {
ret = -ENOMEM;
goto out;
}
@@ -205,7 +207,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,
call_func:
func = rds_info_funcs[optname - RDS_INFO_FIRST];
- if (func == NULL) {
+ if (!func) {
ret = -ENOPROTOOPT;
goto out;
}
@@ -233,7 +235,7 @@ call_func:
ret = -EFAULT;
out:
- for (i = 0; pages != NULL && i < nr_pages; i++)
+ for (i = 0; pages && i < nr_pages; i++)
put_page(pages[i]);
kfree(pages);