Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff0387c3 authored by Markus Elfring's avatar Markus Elfring Committed by Bjorn Helgaas
Browse files

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent f114040e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -322,7 +322,6 @@ 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);
}

+1 −2
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ 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);
	pci_bus_remove_resources(pci_bus);
	pci_release_bus_of_node(pci_bus);
+1 −2
Original line number Diff line number Diff line
@@ -271,7 +271,6 @@ 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);
	return pdev;
}
+1 −2
Original line number Diff line number Diff line
@@ -596,7 +596,6 @@ 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);
		return result;
	}