[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/5] hw/pci-host/pam: Use ARRAY_SIZE() instead of magic value
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 2/5] hw/pci-host/pam: Use ARRAY_SIZE() instead of magic value |
Date: |
Mon, 12 Oct 2020 15:20:13 +0200 |
Replace the magic '4' by ARRAY_SIZE(mem->alias) which is more explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci-host/pam.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c
index a4962057833..4712260025a 100644
--- a/hw/pci-host/pam.c
+++ b/hw/pci-host/pam.c
@@ -51,7 +51,7 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
start, size);
memory_region_transaction_begin();
- for (i = 0; i < 4; ++i) {
+ for (i = 0; i < ARRAY_SIZE(mem->alias); ++i) {
memory_region_set_enabled(&mem->alias[i], false);
memory_region_add_subregion_overlap(system_memory, start,
&mem->alias[i], 1);
--
2.26.2
- [PATCH v2 0/5] hw: Replace some magic by definitions, Philippe Mathieu-Daudé, 2020/10/12
- [PATCH v2 1/5] hw: Replace magic value by PCI_NUM_PINS definition, Philippe Mathieu-Daudé, 2020/10/12
- [PATCH v2 2/5] hw/pci-host/pam: Use ARRAY_SIZE() instead of magic value,
Philippe Mathieu-Daudé <=
- [PATCH v2 3/5] hw/pci-host/versatile: Add the MEMORY_WINDOW_COUNT definition, Philippe Mathieu-Daudé, 2020/10/12
- [PATCH v2 4/5] hw/pci-host/versatile: Add the PCI_BAR_COUNT definition, Philippe Mathieu-Daudé, 2020/10/12
- [PATCH v2 5/5] tests/qtest: Replace magic value by NANOSECONDS_PER_SECOND definition, Philippe Mathieu-Daudé, 2020/10/12
- Re: [PATCH v2 0/5] hw: Replace some magic by definitions, Richard Henderson, 2020/10/13