summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-10-16 12:32:53 -0600
committerBjorn Helgaas <bhelgaas@google.com>2013-10-29 16:57:04 -0600
commit0394cb192db4397753046775a8caa736397737b5 (patch)
treeafb712e0d962650680a1ff9511699ea43b51077d /drivers/pci
parent004bd069f876816f5f9023e8b1498753bca103fa (diff)
downloadlinux-0394cb192db4397753046775a8caa736397737b5.tar.bz2
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c7
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)
if (enable) {
pme_dev = kmalloc(sizeof(struct pci_pme_device),
GFP_KERNEL);
- if (!pme_dev)
- goto out;
+ if (!pme_dev) {
+ dev_warn(&dev->dev, "can't enable PME#\n");
+ return;
+ }
pme_dev->dev = dev;
mutex_lock(&pci_pme_list_mutex);
list_add(&pme_dev->list, &pci_pme_list);
@@ -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");
}