Skip to content

Commit

Permalink
hv:clean io_request.c misra violations
Browse files Browse the repository at this point in the history
Clean the io_request.c's violations reported by the misra tools.
V1->V2:
    remove violations which checked with NULL.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
  • Loading branch information
Shawnshh authored and wenlingz committed Dec 20, 2018
1 parent 530388d commit 1caf58f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions hypervisor/common/io_request.c
Expand Up @@ -73,7 +73,7 @@ void reset_vm_ioreqs(struct acrn_vm *vm)
}
}

static inline bool has_complete_ioreq(struct acrn_vcpu *vcpu)
static inline bool has_complete_ioreq(const struct acrn_vcpu *vcpu)
{
return (get_vhm_req_state(vcpu->vm, vcpu->vcpu_id) == REQ_STATE_COMPLETE);
}
Expand Down Expand Up @@ -169,14 +169,14 @@ uint32_t get_vhm_req_state(struct acrn_vm *vm, uint16_t vhm_req_id)

req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page;
if (req_buf == NULL) {
return (uint32_t)-1;
state = 0xffffffffU;
} else {
stac();
vhm_req = &req_buf->req_queue[vhm_req_id];
state = atomic_load32(&vhm_req->processed);
clac();
}

stac();
vhm_req = &req_buf->req_queue[vhm_req_id];
state = atomic_load32(&vhm_req->processed);
clac();

return state;
}

Expand All @@ -186,12 +186,10 @@ void set_vhm_req_state(struct acrn_vm *vm, uint16_t vhm_req_id, uint32_t state)
struct vhm_request *vhm_req;

req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page;
if (req_buf == NULL) {
return;
if (req_buf != NULL) {
stac();
vhm_req = &req_buf->req_queue[vhm_req_id];
atomic_store32(&vhm_req->processed, state);
clac();
}

stac();
vhm_req = &req_buf->req_queue[vhm_req_id];
atomic_store32(&vhm_req->processed, state);
clac();
}

0 comments on commit 1caf58f

Please sign in to comment.