mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 20:00:13 +00:00
hv: fix MISRA-C violations in dm/vpci
120D: Pointer param should be declared pointer to const. Add 'const' qualifier to function parameters whenever it's possible: alloc_pci_vdev() enumerate_pci_dev() pci_scan_bus() pci_enumeration_cb() partition_mode_vpci_init() partition_mode_vpci_deinit() sharing_mode_vpci_init() sharing_mode_vpci_deinit() vpci_cleanup() 45D: Pointer not checked for null before use. Check pointer vm in vpci_reset_ptdev_intr_info() before using it. Tracked-On: #861 Signed-off-by: Zide Chen <zide.chen@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -138,7 +138,7 @@ enum pci_bar_type {
|
||||
PCIBAR_MEM64,
|
||||
};
|
||||
|
||||
typedef void (*pci_enumeration_cb)(uint16_t pbdf, void *data);
|
||||
typedef void (*pci_enumeration_cb)(uint16_t pbdf, const void *data);
|
||||
|
||||
static inline uint32_t pci_bar_offset(uint32_t idx)
|
||||
{
|
||||
@@ -178,6 +178,6 @@ uint32_t pci_pdev_read_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes);
|
||||
void pci_pdev_write_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes, uint32_t val);
|
||||
void enable_disable_pci_intx(union pci_bdf bdf, bool enable);
|
||||
|
||||
void pci_scan_bus(pci_enumeration_cb cb, void *cb_data);
|
||||
void pci_scan_bus(pci_enumeration_cb cb, const void *cb_data);
|
||||
|
||||
#endif /* PCI_H_ */
|
||||
|
@@ -101,7 +101,7 @@ struct pci_vdev {
|
||||
const struct pci_vdev_ops *ops;
|
||||
#endif
|
||||
|
||||
struct acrn_vpci *vpci;
|
||||
const struct acrn_vpci *vpci;
|
||||
/* The bus/device/function triple of the virtual PCI device. */
|
||||
union pci_bdf vbdf;
|
||||
|
||||
@@ -125,8 +125,8 @@ struct pci_addr_info {
|
||||
};
|
||||
|
||||
struct vpci_ops {
|
||||
int32_t (*init)(struct acrn_vm *vm);
|
||||
void (*deinit)(struct acrn_vm *vm);
|
||||
int32_t (*init)(const struct acrn_vm *vm);
|
||||
void (*deinit)(const struct acrn_vm *vm);
|
||||
void (*cfgread)(struct acrn_vpci *vpci, union pci_bdf vbdf, uint32_t offset,
|
||||
uint32_t bytes, uint32_t *val);
|
||||
void (*cfgwrite)(struct acrn_vpci *vpci, union pci_bdf vbdf, uint32_t offset,
|
||||
@@ -146,7 +146,7 @@ extern const struct pci_vdev_ops pci_ops_vdev_pt;
|
||||
#endif
|
||||
|
||||
void vpci_init(struct acrn_vm *vm);
|
||||
void vpci_cleanup(struct acrn_vm *vm);
|
||||
void vpci_cleanup(const struct acrn_vm *vm);
|
||||
void vpci_set_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf);
|
||||
void vpci_reset_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf);
|
||||
|
||||
|
Reference in New Issue
Block a user