Commit 0394cb19 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: Report pci_pme_active() kmalloc failure

Previously, if kmalloc() failed, we claimed "PME# enabled" in dmesg,
even though we didn't add the device to the pci_pme_list.  This prints
a more correct warning.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 004bd069
...@@ -1638,8 +1638,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable) ...@@ -1638,8 +1638,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
if (enable) { if (enable) {
pme_dev = kmalloc(sizeof(struct pci_pme_device), pme_dev = kmalloc(sizeof(struct pci_pme_device),
GFP_KERNEL); GFP_KERNEL);
if (!pme_dev) if (!pme_dev) {
goto out; dev_warn(&dev->dev, "can't enable PME#\n");
return;
}
pme_dev->dev = dev; pme_dev->dev = dev;
mutex_lock(&pci_pme_list_mutex); mutex_lock(&pci_pme_list_mutex);
list_add(&pme_dev->list, &pci_pme_list); list_add(&pme_dev->list, &pci_pme_list);
...@@ -1660,7 +1662,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable) ...@@ -1660,7 +1662,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
} }
} }
out:
dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment