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>
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;
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)
goto out;
}
- if (verify_command_mask(ib_dev, command)) {
+ if (!verify_command_mask(ib_dev, command)) {
ret = -EOPNOTSUPP;
goto out;
}