From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFTvN-0004Df-Hj for qemu-devel@nongnu.org; Wed, 24 Oct 2018 20:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFTvM-0006nn-PZ for qemu-devel@nongnu.org; Wed, 24 Oct 2018 20:54:57 -0400 Date: Wed, 24 Oct 2018 20:54:53 -0400 From: "Michael S. Tsirkin" Message-ID: <20181025005110.249256-26-mst@redhat.com> References: <20181025005110.249256-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181025005110.249256-1-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 25/28] i440fx: use ARRAY_SIZE for pam_regions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Qiang , qemu-trivial@nongnu.org, Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum From: Li Qiang Cc: qemu-trivial@nongnu.org Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-host/piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 999db824da..82421a86e3 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -142,7 +142,7 @@ static void i440fx_update_memory_mappings(PCII440FXSt= ate *d) PCIDevice *pd =3D PCI_DEVICE(d); =20 memory_region_transaction_begin(); - for (i =3D 0; i < 13; i++) { + for (i =3D 0; i < ARRAY_SIZE(d->pam_regions); i++) { pam_update(&d->pam_regions[i], i, pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]); } @@ -412,7 +412,7 @@ PCIBus *i440fx_init(const char *host_type, const char= *pci_type, =20 init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); - for (i =3D 0; i < 12; ++i) { + for (i =3D 0; i < ARRAY_SIZE(f->pam_regions) - 1; ++i) { init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_sp= ace, &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SI= ZE, PAM_EXPAN_SIZE); --=20 MST