aboutsummaryrefslogtreecommitdiff
path: root/hw/pci-host/q35.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-12-02 14:20:38 +0100
committerLaurent Vivier <laurent@vivier.eu>2020-12-13 17:07:05 +0100
commitf6a3c86ebd39aaedf1ebf89629ec91b5d44b670d (patch)
tree42943407aac4211bba2b77122f460edc30a0794d /hw/pci-host/q35.c
parent01d152c0bfabadc6c93a39e465eb2f66f3f11527 (diff)
downloadqemu-f6a3c86ebd39aaedf1ebf89629ec91b5d44b670d.zip
qemu-f6a3c86ebd39aaedf1ebf89629ec91b5d44b670d.tar.gz
qemu-f6a3c86ebd39aaedf1ebf89629ec91b5d44b670d.tar.bz2
hw/pci-host/pam: Replace magic number by PAM_REGIONS_COUNT definition
While this change helps triskaidekaphobic developers, it is a good practice to avoid magic values and using constant definitions instead. Introduce the PAM_REGIONS_COUNT and use it. No logical change. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Julia Suvorova <jusual@redhat.com> Message-Id: <20201202132038.1276404-1-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/pci-host/q35.c')
-rw-r--r--hw/pci-host/q35.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index b67cb9c..2eb729d 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -641,7 +641,7 @@ static void mch_realize(PCIDevice *d, Error **errp)
init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory,
mch->pci_address_space, &mch->pam_regions[0],
PAM_BIOS_BASE, PAM_BIOS_SIZE);
- for (i = 0; i < 12; ++i) {
+ for (i = 0; i < ARRAY_SIZE(mch->pam_regions) - 1; ++i) {
init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory,
mch->pci_address_space, &mch->pam_regions[i+1],
PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE);