dm: refine assert usage

Remove unnecessary assert and add error handling when required.

Tracked-On: #3252
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Jian Jun Chen
2019-06-18 13:38:37 +08:00
committed by ACRN System Integration
parent 0a8bf6cee4
commit 56469f3edc
4 changed files with 26 additions and 33 deletions

View File

@@ -60,22 +60,18 @@ static void
pci_uart_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
int baridx, uint64_t offset, int size, uint64_t value)
{
assert(baridx == 0);
assert(size == 1);
uart_write(dev->arg, offset, value);
if (baridx == 0 && size == 1)
uart_write(dev->arg, offset, value);
}
uint64_t
pci_uart_read(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
int baridx, uint64_t offset, int size)
{
uint8_t val;
uint8_t val = 0xff;
assert(baridx == 0);
assert(size == 1);
val = uart_read(dev->arg, offset);
if (baridx == 0 && size == 1)
val = uart_read(dev->arg, offset);
return val;
}