mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-03 01:06:53 +00:00
HV: acpi_parser: fix violations of coding guideline C-CU-02
The coding guideline rule C-CU-02 requires that 'only one return statement shall be in a function'. This patch refactors handle_dmar_devscope() which has multiple return statements today. This patch has no semantic changes. Tracked-On: #6776 Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
3f3f4be642
commit
d4055d6157
@ -57,17 +57,13 @@ static union pci_bdf dmar_path_bdf(int32_t path_len, int32_t busno, const struct
|
|||||||
|
|
||||||
static int32_t handle_dmar_devscope(struct dmar_dev_scope *dev_scope, void *addr, int32_t remaining)
|
static int32_t handle_dmar_devscope(struct dmar_dev_scope *dev_scope, void *addr, int32_t remaining)
|
||||||
{
|
{
|
||||||
int32_t path_len;
|
int32_t path_len, ret = -1;
|
||||||
union pci_bdf dmar_bdf;
|
union pci_bdf dmar_bdf;
|
||||||
struct acpi_dmar_pci_path *path;
|
struct acpi_dmar_pci_path *path;
|
||||||
struct acpi_dmar_device_scope *apci_devscope = addr;
|
struct acpi_dmar_device_scope *apci_devscope = addr;
|
||||||
|
|
||||||
if (remaining < (int32_t)sizeof(struct acpi_dmar_device_scope))
|
if ((remaining >= (int32_t)sizeof(struct acpi_dmar_device_scope)) &&
|
||||||
return -1;
|
(remaining >= (int32_t)apci_devscope->length)) {
|
||||||
|
|
||||||
if (remaining < apci_devscope->length)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
path = (struct acpi_dmar_pci_path *)(apci_devscope + 1);
|
path = (struct acpi_dmar_pci_path *)(apci_devscope + 1);
|
||||||
path_len = (apci_devscope->length -
|
path_len = (apci_devscope->length -
|
||||||
sizeof(struct acpi_dmar_device_scope)) /
|
sizeof(struct acpi_dmar_device_scope)) /
|
||||||
@ -78,8 +74,10 @@ static int32_t handle_dmar_devscope(struct dmar_dev_scope *dev_scope, void *addr
|
|||||||
dev_scope->type = apci_devscope->entry_type;
|
dev_scope->type = apci_devscope->entry_type;
|
||||||
dev_scope->bus = dmar_bdf.fields.bus;
|
dev_scope->bus = dmar_bdf.fields.bus;
|
||||||
dev_scope->devfun = dmar_bdf.fields.devfun;
|
dev_scope->devfun = dmar_bdf.fields.devfun;
|
||||||
|
ret = (int32_t)apci_devscope->length;
|
||||||
|
}
|
||||||
|
|
||||||
return apci_devscope->length;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t get_drhd_dev_scope_cnt(struct acpi_dmar_hardware_unit *drhd)
|
static uint32_t get_drhd_dev_scope_cnt(struct acpi_dmar_hardware_unit *drhd)
|
||||||
|
Loading…
Reference in New Issue
Block a user