diff mbox series

[v2,30/35] acpi: arm/virt: build_spcr: fix invalid cast

Message ID 20210708154617.1538485-31-imammedo@redhat.com (mailing list archive)
State New, archived
Headers show
Series acpi: refactor error prone build_header() and packed structures usage in ACPI tables | expand

Commit Message

Igor Mammedov July 8, 2021, 3:46 p.m. UTC
implicit cast to structure uint8_t member didn't raise error when
assigning value from incorrect enum, but when using build_append_gas()
(next patch) it will error out with (clang):
  implicit conversion from enumeration type 'AmlRegionSpace'
  to different enumeration type 'AmlAddressSpace'
fix cast error by using correct AML_AS_SYSTEM_MEMORY enum

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
CC: drjones@redhat.com
CC: peter.maydell@linaro.org
CC: shannon.zhaosl@gmail.com
CC: qemu-arm@nongnu.org
---
 hw/arm/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Auger Sept. 2, 2021, 3:51 p.m. UTC | #1
On 7/8/21 5:46 PM, Igor Mammedov wrote:
> implicit cast to structure uint8_t member didn't raise error when
> assigning value from incorrect enum, but when using build_append_gas()
> (next patch) it will error out with (clang):
>   implicit conversion from enumeration type 'AmlRegionSpace'
>   to different enumeration type 'AmlAddressSpace'
> fix cast error by using correct AML_AS_SYSTEM_MEMORY enum
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

> ---
> CC: drjones@redhat.com
> CC: peter.maydell@linaro.org
> CC: shannon.zhaosl@gmail.com
> CC: qemu-arm@nongnu.org
> ---
>  hw/arm/virt-acpi-build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index b88ea4b70a..a07540affb 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -361,7 +361,7 @@ build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>  
>      spcr->interface_type = 0x3;    /* ARM PL011 UART */
>  
> -    spcr->base_address.space_id = AML_SYSTEM_MEMORY;
> +    spcr->base_address.space_id = AML_AS_SYSTEM_MEMORY;
>      spcr->base_address.bit_width = 8;
>      spcr->base_address.bit_offset = 0;
>      spcr->base_address.access_width = 1;
>
diff mbox series

Patch

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index b88ea4b70a..a07540affb 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -361,7 +361,7 @@  build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 
     spcr->interface_type = 0x3;    /* ARM PL011 UART */
 
-    spcr->base_address.space_id = AML_SYSTEM_MEMORY;
+    spcr->base_address.space_id = AML_AS_SYSTEM_MEMORY;
     spcr->base_address.bit_width = 8;
     spcr->base_address.bit_offset = 0;
     spcr->base_address.access_width = 1;