Commit 0394cb192db4397753046775a8caa736397737b5
1 parent
004bd069f8
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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>
Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff
drivers/pci/pci.c
... | ... | @@ -1638,8 +1638,10 @@ |
1638 | 1638 | if (enable) { |
1639 | 1639 | pme_dev = kmalloc(sizeof(struct pci_pme_device), |
1640 | 1640 | GFP_KERNEL); |
1641 | - if (!pme_dev) | |
1642 | - goto out; | |
1641 | + if (!pme_dev) { | |
1642 | + dev_warn(&dev->dev, "can't enable PME#\n"); | |
1643 | + return; | |
1644 | + } | |
1643 | 1645 | pme_dev->dev = dev; |
1644 | 1646 | mutex_lock(&pci_pme_list_mutex); |
1645 | 1647 | list_add(&pme_dev->list, &pci_pme_list); |
... | ... | @@ -1660,7 +1662,6 @@ |
1660 | 1662 | } |
1661 | 1663 | } |
1662 | 1664 | |
1663 | -out: | |
1664 | 1665 | dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); |
1665 | 1666 | } |
1666 | 1667 |