Skip to content

Commit

Permalink
RDMA/uverbs: Make write() handlers return 0 on success
Browse files Browse the repository at this point in the history
Currently they return the command length, while all other handlers return
0. This makes the write path closer to the write_ex and ioctl path.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
  • Loading branch information
Jason Gunthorpe committed Nov 26, 2018
1 parent 8313c10 commit 7106a97
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 191 deletions.
10 changes: 4 additions & 6 deletions drivers/infiniband/core/rdma_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,11 @@ struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
}

/*
* Does both uobj_get_destroy() and uobj_put_destroy(). Returns success_res
* on success (negative errno on failure). For use by callers that do not need
* the uobj.
* Does both uobj_get_destroy() and uobj_put_destroy(). Returns 0 on success
* (negative errno on failure). For use by callers that do not need the uobj.
*/
int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
const struct uverbs_attr_bundle *attrs,
int success_res)
const struct uverbs_attr_bundle *attrs)
{
struct ib_uobject *uobj;

Expand All @@ -260,7 +258,7 @@ int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
return PTR_ERR(uobj);

rdma_lookup_put_uobject(uobj, UVERBS_LOOKUP_WRITE);
return success_res;
return 0;
}

/* alloc_uobj must be undone by uverbs_destroy_uobject() */
Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/core/rdma_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ struct uverbs_api_ioctl_method {
};

struct uverbs_api_write_method {
ssize_t (*handler)(struct uverbs_attr_bundle *attrs,
const char __user *buf, int in_len, int out_len);
int (*handler)(struct uverbs_attr_bundle *attrs, const char __user *buf,
int in_len, int out_len);
int (*handler_ex)(struct uverbs_attr_bundle *attrs,
struct ib_udata *ucore, struct ib_udata *uhw);
u8 disabled:1;
Expand Down
Loading

0 comments on commit 7106a97

Please sign in to comment.