diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-10-16 14:32:53 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-10-29 18:57:04 -0400 |
commit | 0394cb192db4397753046775a8caa736397737b5 (patch) | |
tree | afb712e0d962650680a1ff9511699ea43b51077d | |
parent | 004bd069f876816f5f9023e8b1498753bca103fa (diff) |
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: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/pci/pci.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ad7fc72a40a0..36cc8d5ae8b2 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1638,8 +1638,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable) | |||
1638 | if (enable) { | 1638 | if (enable) { |
1639 | pme_dev = kmalloc(sizeof(struct pci_pme_device), | 1639 | pme_dev = kmalloc(sizeof(struct pci_pme_device), |
1640 | GFP_KERNEL); | 1640 | GFP_KERNEL); |
1641 | if (!pme_dev) | 1641 | if (!pme_dev) { |
1642 | goto out; | 1642 | dev_warn(&dev->dev, "can't enable PME#\n"); |
1643 | return; | ||
1644 | } | ||
1643 | pme_dev->dev = dev; | 1645 | pme_dev->dev = dev; |
1644 | mutex_lock(&pci_pme_list_mutex); | 1646 | mutex_lock(&pci_pme_list_mutex); |
1645 | list_add(&pme_dev->list, &pci_pme_list); | 1647 | list_add(&pme_dev->list, &pci_pme_list); |
@@ -1660,7 +1662,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable) | |||
1660 | } | 1662 | } |
1661 | } | 1663 | } |
1662 | 1664 | ||
1663 | out: | ||
1664 | dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); | 1665 | dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); |
1665 | } | 1666 | } |
1666 | 1667 | ||