[PATCH] acpi: viot: fix build fail on bionic and focal

Ivan Hu ivan.hu at canonical.com
Tue Jan 16 06:52:38 UTC 2024


BugLing: https://bugs.launchpad.net/fwts/+bug/2049459

Got build fail below,
acpi/viot/viot.c:76:5: error: a label can only be part of a statement and a declaration is not a statement
   76 | fwts_acpi_viot_pci_rng_node *pci_rng = (fwts_acpi_viot_pci_rng_node *)(table->data + offset);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
acpi/viot/viot.c:93:5: error: a label can only be part of a statement and a declaration is not a statement
   93 | fwts_acpi_viot_mmio_ep_node *mmio_ep = (fwts_acpi_viot_mmio_ep_node *)(table->data + offset);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
acpi/viot/viot.c:107:5: error: a label can only be part of a statement and a declaration is not a statement
  107 | fwts_acpi_viot_pci_iommu_node *pci_iommu = (fwts_acpi_viot_pci_iommu_node *)(table->data + offset);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acpi/viot/viot.c:120:5: error: a label can only be part of a statement and a declaration is not a statement
  120 | fwts_acpi_viot_mmio_iommu_node *mmio_iommu = (fwts_acpi_viot_mmio_iommu_node *)(table->data + offset);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[4]: *** [Makefile:4244: acpi/viot/fwts-viot.o] Error 1

Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
 src/acpi/viot/viot.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/acpi/viot/viot.c b/src/acpi/viot/viot.c
index 74394fec..b6c3cb50 100644
--- a/src/acpi/viot/viot.c
+++ b/src/acpi/viot/viot.c
@@ -71,9 +71,14 @@ static int viot_test1(fwts_framework *fw)
 			return FWTS_OK;
 		}
 
+		fwts_acpi_viot_pci_rng_node *pci_rng = NULL;
+		fwts_acpi_viot_mmio_ep_node *mmio_ep = NULL;
+		fwts_acpi_viot_pci_iommu_node *pci_iommu = NULL;
+		fwts_acpi_viot_mmio_iommu_node *mmio_iommu = NULL;
+
 		switch(node_hdr->type) {
 			case 1:
-				fwts_acpi_viot_pci_rng_node *pci_rng = (fwts_acpi_viot_pci_rng_node *)(table->data + offset);
+				pci_rng = (fwts_acpi_viot_pci_rng_node *)(table->data + offset);
 				fwts_log_info_verbatim(fw, "  PCI Range Node Structure:");
 				fwts_log_info_simp_int(fw, "    Type:               ", pci_rng->hdr.type);
 				fwts_log_info_simp_int(fw, "    Reserved:           ", pci_rng->hdr.reserved);
@@ -90,7 +95,7 @@ static int viot_test1(fwts_framework *fw)
 				offset += sizeof(fwts_acpi_viot_pci_rng_node);
 				break;
 			case 2:
-				fwts_acpi_viot_mmio_ep_node *mmio_ep = (fwts_acpi_viot_mmio_ep_node *)(table->data + offset);
+				mmio_ep = (fwts_acpi_viot_mmio_ep_node *)(table->data + offset);
 				fwts_log_info_verbatim(fw, "  Single MMIO Endpoint Node Structure:");
 				fwts_log_info_simp_int(fw, "    Type:               ", mmio_ep->hdr.type);
 				fwts_log_info_simp_int(fw, "    Reserved:           ", mmio_ep->hdr.reserved);
@@ -104,7 +109,7 @@ static int viot_test1(fwts_framework *fw)
 				offset += sizeof(fwts_acpi_viot_mmio_ep_node);
 				break;
 			case 3:
-				fwts_acpi_viot_pci_iommu_node *pci_iommu = (fwts_acpi_viot_pci_iommu_node *)(table->data + offset);
+				pci_iommu = (fwts_acpi_viot_pci_iommu_node *)(table->data + offset);
 				fwts_log_info_verbatim(fw, "  Virtio-iommu based on virtio-pci Node Structure:");
 				fwts_log_info_simp_int(fw, "    Type:               ", pci_iommu->hdr.type);
 				fwts_log_info_simp_int(fw, "    Reserved:           ", pci_iommu->hdr.reserved);
@@ -117,7 +122,7 @@ static int viot_test1(fwts_framework *fw)
 				offset += sizeof(fwts_acpi_viot_pci_iommu_node);
 				break;
 			case 4:
-				fwts_acpi_viot_mmio_iommu_node *mmio_iommu = (fwts_acpi_viot_mmio_iommu_node *)(table->data + offset);
+				mmio_iommu = (fwts_acpi_viot_mmio_iommu_node *)(table->data + offset);
 				fwts_log_info_verbatim(fw, "  Virtio-iommu based on virtio-pci Node Structure:");
 				fwts_log_info_simp_int(fw, "    Type:               ", mmio_iommu->hdr.type);
 				fwts_log_info_simp_int(fw, "    Reserved:           ", mmio_iommu->hdr.reserved);
-- 
2.34.1




More information about the fwts-devel mailing list