aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2018-02-21 18:12:31 +0200
committerDoug Ledford <dledford@redhat.com>2018-02-22 22:29:10 -0500
commitb5bc59818614a9d6d1fa2347b14dd52c4774fb70 (patch)
tree70df7899e41cf7f08cd47488bb68f89674c499f4 /drivers/infiniband/core/uverbs_main.c
parentMerge branch 'k.o/for-rc' into k.o/wip/dl-for-next (diff)
downloadlinux-dev-b5bc59818614a9d6d1fa2347b14dd52c4774fb70.tar.xz
linux-dev-b5bc59818614a9d6d1fa2347b14dd52c4774fb70.zip
RDMA/uverbs: Convert command mask validity check function to be bool
The function validate_command_mask() returns only two results: success or failure, so convert it to return bool instead of 0 and -1. Reported-by: Noa Osherovich <noaos@mellanox.com> Reviewed-by: Matan Barak <matanb@mellanox.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to '')
-rw-r--r--drivers/infiniband/core/uverbs_main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index b1ca223aa380..7cadd4b5a0c0 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -635,7 +635,7 @@ err_put_refs:
return filp;
}
-static int verify_command_mask(struct ib_device *ib_dev, __u32 command)
+static bool verify_command_mask(struct ib_device *ib_dev, __u32 command)
{
u64 mask;
@@ -645,9 +645,9 @@ static int verify_command_mask(struct ib_device *ib_dev, __u32 command)
mask = ib_dev->uverbs_ex_cmd_mask;
if (mask & ((u64)1 << command))
- return 0;
+ return true;
- return -1;
+ return false;
}
static bool verify_command_idx(u32 command, bool extended)
@@ -706,7 +706,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
goto out;
}
- if (verify_command_mask(ib_dev, command)) {
+ if (!verify_command_mask(ib_dev, command)) {
ret = -EOPNOTSUPP;
goto out;
}