mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-08 12:19:06 +00:00
hv: dm: fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule. Reduce the count of the "return entries". Fix the violations which is comply with the cases list below: 1.Function has 2 return entries. 2.The first return entry is used to return the error code of checking variable whether is valid. Fix the violations in "if else" format. V1->V2: make the return value match to int32_t Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -147,12 +147,16 @@ static inline uint32_t pci_bar_offset(uint32_t idx)
|
||||
|
||||
static inline bool pci_bar_access(uint32_t offset)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
if ((offset >= pci_bar_offset(0U))
|
||||
&& (offset < pci_bar_offset(PCI_BAR_COUNT))) {
|
||||
return true;
|
||||
ret = true;
|
||||
} else {
|
||||
return false;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline uint8_t pci_bus(uint16_t bdf)
|
||||
|
@@ -34,14 +34,14 @@
|
||||
|
||||
struct pci_vdev;
|
||||
struct pci_vdev_ops {
|
||||
int (*init)(struct pci_vdev *vdev);
|
||||
int32_t (*init)(struct pci_vdev *vdev);
|
||||
|
||||
int (*deinit)(struct pci_vdev *vdev);
|
||||
int32_t (*deinit)(struct pci_vdev *vdev);
|
||||
|
||||
int (*cfgwrite)(struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t val);
|
||||
|
||||
int (*cfgread)(struct pci_vdev *vdev, uint32_t offset,
|
||||
int32_t (*cfgread)(struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t *val);
|
||||
};
|
||||
|
||||
@@ -125,7 +125,7 @@ struct pci_addr_info {
|
||||
};
|
||||
|
||||
struct vpci_ops {
|
||||
int (*init)(struct acrn_vm *vm);
|
||||
int32_t (*init)(struct acrn_vm *vm);
|
||||
void (*deinit)(struct acrn_vm *vm);
|
||||
void (*cfgread)(struct vpci *vpci, union pci_bdf vbdf, uint32_t offset,
|
||||
uint32_t bytes, uint32_t *val);
|
||||
|
Reference in New Issue
Block a user