Skip to content

Commit

Permalink
PCI: Report pci_pme_active() kmalloc failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bjorn Helgaas committed Oct 29, 2013
1 parent 004bd06 commit 0394cb1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
}

Expand Down

0 comments on commit 0394cb1

Please sign in to comment.