summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2014-11-10 21:02:17 -0700
committerBjorn Helgaas <bhelgaas@google.com>2014-11-10 21:02:17 -0700
commitff0387c3777f2438bad2088abe442c9f231b0be4 (patch)
tree8c3697b4a4f9474f1a9c06b2f36692d8436371a6 /drivers/pci
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
downloadop-kernel-dev-ff0387c3777f2438bad2088abe442c9f231b0be4.zip
op-kernel-dev-ff0387c3777f2438bad2088abe442c9f231b0be4.tar.gz
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-acpi.c3
-rw-r--r--drivers/pci/probe.c3
-rw-r--r--drivers/pci/search.c3
-rw-r--r--drivers/pci/xen-pcifront.c3
4 files changed, 4 insertions, 8 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 6ebf8ed..3542150 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)
pci_wakeup_event(pci_dev);
pm_runtime_resume(&pci_dev->dev);
- if (pci_dev->subordinate)
- pci_pme_wakeup_bus(pci_dev->subordinate);
+ pci_pme_wakeup_bus(pci_dev->subordinate);
}
/**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5ed9930..eb927c0 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -87,8 +87,7 @@ static void release_pcibus_dev(struct device *dev)
{
struct pci_bus *pci_bus = to_pci_bus(dev);
- if (pci_bus->bridge)
- put_device(pci_bus->bridge);
+ put_device(pci_bus->bridge);
pci_bus_remove_resources(pci_bus);
pci_release_bus_of_node(pci_bus);
kfree(pci_bus);
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index a81f413..a20ce7d 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,
match_pci_dev_by_id);
if (dev)
pdev = to_pci_dev(dev);
- if (from)
- pci_dev_put(from);
+ pci_dev_put(from);
return pdev;
}
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 116ca37..f01b26d 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,
pcidev = pci_get_bus_and_slot(bus, devfn);
if (!pcidev || !pcidev->driver) {
dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
- if (pcidev)
- pci_dev_put(pcidev);
+ pci_dev_put(pcidev);
return result;
}
pdrv = pcidev->driver;
OpenPOWER on IntegriCloud