diff options
-rw-r--r-- | drivers/pci/hotplug/pciehp_acpi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/pciehp_acpi.c b/drivers/pci/hotplug/pciehp_acpi.c index 21734c311529..96048010e7d9 100644 --- a/drivers/pci/hotplug/pciehp_acpi.c +++ b/drivers/pci/hotplug/pciehp_acpi.c | |||
@@ -79,14 +79,15 @@ static int __init dummy_probe(struct pcie_device *dev) | |||
79 | struct slot *slot, *tmp; | 79 | struct slot *slot, *tmp; |
80 | struct pci_dev *pdev = dev->port; | 80 | struct pci_dev *pdev = dev->port; |
81 | struct pci_bus *pbus = pdev->subordinate; | 81 | struct pci_bus *pbus = pdev->subordinate; |
82 | if (!(slot = kzalloc(sizeof(*slot), GFP_KERNEL))) | ||
83 | return -ENOMEM; | ||
84 | /* Note: pciehp_detect_mode != PCIEHP_DETECT_ACPI here */ | 82 | /* Note: pciehp_detect_mode != PCIEHP_DETECT_ACPI here */ |
85 | if (pciehp_get_hp_hw_control_from_firmware(pdev)) | 83 | if (pciehp_get_hp_hw_control_from_firmware(pdev)) |
86 | return -ENODEV; | 84 | return -ENODEV; |
87 | if (!(pos = pci_find_capability(pdev, PCI_CAP_ID_EXP))) | 85 | if (!(pos = pci_find_capability(pdev, PCI_CAP_ID_EXP))) |
88 | return -ENODEV; | 86 | return -ENODEV; |
89 | pci_read_config_dword(pdev, pos + PCI_EXP_SLTCAP, &slot_cap); | 87 | pci_read_config_dword(pdev, pos + PCI_EXP_SLTCAP, &slot_cap); |
88 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | ||
89 | if (!slot) | ||
90 | return -ENOMEM; | ||
90 | slot->number = slot_cap >> 19; | 91 | slot->number = slot_cap >> 19; |
91 | list_for_each_entry(tmp, &dummy_slots, slot_list) { | 92 | list_for_each_entry(tmp, &dummy_slots, slot_list) { |
92 | if (tmp->number == slot->number) | 93 | if (tmp->number == slot->number) |