RDMA/uverbs: Unify return values of not supported command
The non-existing command is supposed to return -EOPNOTSUPP, but the current code returns different errors for different flows for the same failure. This patch unifies those flows. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
a9ed5b38aa
commit
f2630ce2fb
|
@ -653,9 +653,11 @@ static bool verify_command_mask(struct ib_device *ib_dev, __u32 command)
|
||||||
static bool verify_command_idx(u32 command, bool extended)
|
static bool verify_command_idx(u32 command, bool extended)
|
||||||
{
|
{
|
||||||
if (extended)
|
if (extended)
|
||||||
return command < ARRAY_SIZE(uverbs_ex_cmd_table);
|
return command < ARRAY_SIZE(uverbs_ex_cmd_table) &&
|
||||||
|
uverbs_ex_cmd_table[command];
|
||||||
|
|
||||||
return command < ARRAY_SIZE(uverbs_cmd_table);
|
return command < ARRAY_SIZE(uverbs_cmd_table) &&
|
||||||
|
uverbs_cmd_table[command];
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
||||||
|
@ -730,11 +732,6 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flags) {
|
if (!flags) {
|
||||||
if (!uverbs_cmd_table[command]) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hdr.in_words * 4 != count) {
|
if (hdr.in_words * 4 != count) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -749,11 +746,6 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
||||||
struct ib_udata uhw;
|
struct ib_udata uhw;
|
||||||
size_t written_count = count;
|
size_t written_count = count;
|
||||||
|
|
||||||
if (!uverbs_ex_cmd_table[command]) {
|
|
||||||
ret = -ENOSYS;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file->ucontext) {
|
if (!file->ucontext) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue