diff options
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 30923eb68ec7..b81307b625a6 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -894,7 +894,6 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, | |||
894 | { | 894 | { |
895 | struct ib_uverbs_poll_cq cmd; | 895 | struct ib_uverbs_poll_cq cmd; |
896 | struct ib_uverbs_poll_cq_resp *resp; | 896 | struct ib_uverbs_poll_cq_resp *resp; |
897 | struct ib_uobject *uobj; | ||
898 | struct ib_cq *cq; | 897 | struct ib_cq *cq; |
899 | struct ib_wc *wc; | 898 | struct ib_wc *wc; |
900 | int ret = 0; | 899 | int ret = 0; |
@@ -915,16 +914,15 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, | |||
915 | goto out_wc; | 914 | goto out_wc; |
916 | } | 915 | } |
917 | 916 | ||
918 | uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); | 917 | cq = idr_read_cq(cmd.cq_handle, file->ucontext); |
919 | if (!uobj) { | 918 | if (!cq) { |
920 | ret = -EINVAL; | 919 | ret = -EINVAL; |
921 | goto out; | 920 | goto out; |
922 | } | 921 | } |
923 | cq = uobj->object; | ||
924 | 922 | ||
925 | resp->count = ib_poll_cq(cq, cmd.ne, wc); | 923 | resp->count = ib_poll_cq(cq, cmd.ne, wc); |
926 | 924 | ||
927 | put_uobj_read(uobj); | 925 | put_cq_read(cq); |
928 | 926 | ||
929 | for (i = 0; i < resp->count; i++) { | 927 | for (i = 0; i < resp->count; i++) { |
930 | resp->wc[i].wr_id = wc[i].wr_id; | 928 | resp->wc[i].wr_id = wc[i].wr_id; |
@@ -959,21 +957,19 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, | |||
959 | int out_len) | 957 | int out_len) |
960 | { | 958 | { |
961 | struct ib_uverbs_req_notify_cq cmd; | 959 | struct ib_uverbs_req_notify_cq cmd; |
962 | struct ib_uobject *uobj; | ||
963 | struct ib_cq *cq; | 960 | struct ib_cq *cq; |
964 | 961 | ||
965 | if (copy_from_user(&cmd, buf, sizeof cmd)) | 962 | if (copy_from_user(&cmd, buf, sizeof cmd)) |
966 | return -EFAULT; | 963 | return -EFAULT; |
967 | 964 | ||
968 | uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); | 965 | cq = idr_read_cq(cmd.cq_handle, file->ucontext); |
969 | if (!uobj) | 966 | if (!cq) |
970 | return -EINVAL; | 967 | return -EINVAL; |
971 | cq = uobj->object; | ||
972 | 968 | ||
973 | ib_req_notify_cq(cq, cmd.solicited_only ? | 969 | ib_req_notify_cq(cq, cmd.solicited_only ? |
974 | IB_CQ_SOLICITED : IB_CQ_NEXT_COMP); | 970 | IB_CQ_SOLICITED : IB_CQ_NEXT_COMP); |
975 | 971 | ||
976 | put_uobj_read(uobj); | 972 | put_cq_read(cq); |
977 | 973 | ||
978 | return in_len; | 974 | return in_len; |
979 | } | 975 | } |