diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-11-13 19:33:42 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-11-24 18:28:37 -0500 |
commit | e823d6ff581c5d1d76aa8c73a202d7d1419d34b8 (patch) | |
tree | f18438693bc2a1871805f9cb7ae46e363184d605 /arch/x86/pci | |
parent | 5663b1b963183e98ece3e77e471da833bb5ad2ff (diff) |
x86/PCI: MMCONFIG: count MCFG structures with local variable
Use a local variable, not pci_mmcfg_config_num, to count MCFG entries.
No functional change, but simplifies future changes.
Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r-- | arch/x86/pci/mmconfig-shared.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 9bf04bcfb9c2..fbadb89c71eb 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -555,7 +555,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header) | |||
555 | { | 555 | { |
556 | struct acpi_table_mcfg *mcfg; | 556 | struct acpi_table_mcfg *mcfg; |
557 | unsigned long i; | 557 | unsigned long i; |
558 | int config_size; | 558 | int entries, config_size; |
559 | 559 | ||
560 | if (!header) | 560 | if (!header) |
561 | return -EINVAL; | 561 | return -EINVAL; |
@@ -564,17 +564,18 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header) | |||
564 | 564 | ||
565 | /* how many config structures do we have */ | 565 | /* how many config structures do we have */ |
566 | pci_mmcfg_config_num = 0; | 566 | pci_mmcfg_config_num = 0; |
567 | entries = 0; | ||
567 | i = header->length - sizeof(struct acpi_table_mcfg); | 568 | i = header->length - sizeof(struct acpi_table_mcfg); |
568 | while (i >= sizeof(struct acpi_mcfg_allocation)) { | 569 | while (i >= sizeof(struct acpi_mcfg_allocation)) { |
569 | ++pci_mmcfg_config_num; | 570 | entries++; |
570 | i -= sizeof(struct acpi_mcfg_allocation); | 571 | i -= sizeof(struct acpi_mcfg_allocation); |
571 | }; | 572 | }; |
572 | if (pci_mmcfg_config_num == 0) { | 573 | if (entries == 0) { |
573 | printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); | 574 | printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); |
574 | return -ENODEV; | 575 | return -ENODEV; |
575 | } | 576 | } |
576 | 577 | ||
577 | config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config); | 578 | config_size = entries * sizeof(*pci_mmcfg_config); |
578 | pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL); | 579 | pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL); |
579 | if (!pci_mmcfg_config) { | 580 | if (!pci_mmcfg_config) { |
580 | printk(KERN_WARNING PREFIX | 581 | printk(KERN_WARNING PREFIX |
@@ -583,8 +584,9 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header) | |||
583 | } | 584 | } |
584 | 585 | ||
585 | memcpy(pci_mmcfg_config, &mcfg[1], config_size); | 586 | memcpy(pci_mmcfg_config, &mcfg[1], config_size); |
587 | pci_mmcfg_config_num = entries; | ||
586 | 588 | ||
587 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | 589 | for (i = 0; i < entries; i++) { |
588 | if (acpi_mcfg_check_entry(mcfg, &pci_mmcfg_config[i])) { | 590 | if (acpi_mcfg_check_entry(mcfg, &pci_mmcfg_config[i])) { |
589 | kfree(pci_mmcfg_config); | 591 | kfree(pci_mmcfg_config); |
590 | pci_mmcfg_config_num = 0; | 592 | pci_mmcfg_config_num = 0; |