diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2014-11-10 23:02:17 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-11-10 23:02:17 -0500 |
commit | ff0387c3777f2438bad2088abe442c9f231b0be4 (patch) | |
tree | 8c3697b4a4f9474f1a9c06b2f36692d8436371a6 | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
PCI: Delete unnecessary NULL pointer checks
The functions pci_dev_put(), pci_pme_wakeup_bus(), and put_device() return
immediately if their argument is NULL. Thus the test before the call is
not needed.
Remove these unnecessary tests.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/pci-acpi.c | 3 | ||||
-rw-r--r-- | drivers/pci/probe.c | 3 | ||||
-rw-r--r-- | drivers/pci/search.c | 3 | ||||
-rw-r--r-- | drivers/pci/xen-pcifront.c | 3 |
4 files changed, 4 insertions, 8 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 6ebf8edc5f3c..3542150fc8a3 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -322,8 +322,7 @@ static void pci_acpi_wake_dev(struct work_struct *work) | |||
322 | pci_wakeup_event(pci_dev); | 322 | pci_wakeup_event(pci_dev); |
323 | pm_runtime_resume(&pci_dev->dev); | 323 | pm_runtime_resume(&pci_dev->dev); |
324 | 324 | ||
325 | if (pci_dev->subordinate) | 325 | pci_pme_wakeup_bus(pci_dev->subordinate); |
326 | pci_pme_wakeup_bus(pci_dev->subordinate); | ||
327 | } | 326 | } |
328 | 327 | ||
329 | /** | 328 | /** |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5ed99309c758..eb927c04e290 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -87,8 +87,7 @@ static void release_pcibus_dev(struct device *dev) | |||
87 | { | 87 | { |
88 | struct pci_bus *pci_bus = to_pci_bus(dev); | 88 | struct pci_bus *pci_bus = to_pci_bus(dev); |
89 | 89 | ||
90 | if (pci_bus->bridge) | 90 | put_device(pci_bus->bridge); |
91 | put_device(pci_bus->bridge); | ||
92 | pci_bus_remove_resources(pci_bus); | 91 | pci_bus_remove_resources(pci_bus); |
93 | pci_release_bus_of_node(pci_bus); | 92 | pci_release_bus_of_node(pci_bus); |
94 | kfree(pci_bus); | 93 | kfree(pci_bus); |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index a81f413083e4..a20ce7d5e2a7 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -271,8 +271,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, | |||
271 | match_pci_dev_by_id); | 271 | match_pci_dev_by_id); |
272 | if (dev) | 272 | if (dev) |
273 | pdev = to_pci_dev(dev); | 273 | pdev = to_pci_dev(dev); |
274 | if (from) | 274 | pci_dev_put(from); |
275 | pci_dev_put(from); | ||
276 | return pdev; | 275 | return pdev; |
277 | } | 276 | } |
278 | 277 | ||
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 116ca3746adb..f01b26dc83a4 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -596,8 +596,7 @@ static pci_ers_result_t pcifront_common_process(int cmd, | |||
596 | pcidev = pci_get_bus_and_slot(bus, devfn); | 596 | pcidev = pci_get_bus_and_slot(bus, devfn); |
597 | if (!pcidev || !pcidev->driver) { | 597 | if (!pcidev || !pcidev->driver) { |
598 | dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n"); | 598 | dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n"); |
599 | if (pcidev) | 599 | pci_dev_put(pcidev); |
600 | pci_dev_put(pcidev); | ||
601 | return result; | 600 | return result; |
602 | } | 601 | } |
603 | pdrv = pcidev->driver; | 602 | pdrv = pcidev->driver; |