PCI/PM: Call .bridge_d3() hook only if non-NULL
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 7 Apr 2020 23:23:15 +0000 (18:23 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jul 2020 07:34:12 +0000 (09:34 +0200)
commitbe95ded2aee1503d66a2eb0bc37de9f3a112c2c7
treeca438f00061a690c0de7a9703873d3e64cd58542
parent7e655371a5471eecf152f05c55de6531e23c5918
PCI/PM: Call .bridge_d3() hook only if non-NULL

commit c3aaf086701d05a82c8156ee8620af41e5a7d6fe upstream.

26ad34d510a8 ("PCI / ACPI: Whitelist D3 for more PCIe hotplug ports") added
the struct pci_platform_pm_ops.bridge_d3() function pointer and
platform_pci_bridge_d3() to use it.

The .bridge_d3() op is implemented by acpi_pci_platform_pm, but not by
mid_pci_platform_pm.  We don't expect platform_pci_bridge_d3() to be called
on Intel MID platforms, but nothing in the code itself would prevent that.

Check the .bridge_d3() pointer for NULL before calling it.

Fixes: 26ad34d510a8 ("PCI / ACPI: Whitelist D3 for more PCIe hotplug ports")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/pci.c