Skip to content

Commit

Permalink
hv:fix return value violation for vioapic_get_rte
Browse files Browse the repository at this point in the history
Change this API to void type
Add pre-condition, state the input parameters are not NULL.

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
  • Loading branch information
mingqiangchi authored and lijinxia committed Aug 2, 2018
1 parent cd3a62f commit ae8836d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions hypervisor/arch/x86/guest/vioapic.c
Expand Up @@ -629,17 +629,16 @@ int vioapic_mmio_access_handler(struct vcpu *vcpu, struct io_request *io_req,
return ret;
}

bool vioapic_get_rte(struct vm *vm, uint8_t pin, union ioapic_rte *rte)
/**
* @pre vm->arch_vm.virt_ioapic != NULL
* @pre rte != NULL
*/
void vioapic_get_rte(struct vm *vm, uint8_t pin, union ioapic_rte *rte)
{
struct vioapic *vioapic;

vioapic = vm_ioapic(vm);
if ((vioapic != NULL) && (rte != NULL)) {
*rte = vioapic->rtbl[pin];
return true;
} else {
return false;
}
*rte = vioapic->rtbl[pin];
}

#ifdef HV_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion hypervisor/include/arch/x86/guest/vioapic.h
Expand Up @@ -51,7 +51,7 @@ void vioapic_mmio_read(struct vm *vm, uint64_t gpa, uint32_t *rval);

uint8_t vioapic_pincount(struct vm *vm);
void vioapic_process_eoi(struct vm *vm, uint32_t vector);
bool vioapic_get_rte(struct vm *vm, uint8_t pin, union ioapic_rte *rte);
void vioapic_get_rte(struct vm *vm, uint8_t pin, union ioapic_rte *rte);
int vioapic_mmio_access_handler(struct vcpu *vcpu,
struct io_request *io_req, __unused void *handler_private_data);

Expand Down

0 comments on commit ae8836d

Please sign in to comment.