PCI: Return NULL for to_pci_driver(NULL)
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 12 Oct 2021 20:42:59 +0000 (15:42 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 12 Oct 2021 22:37:15 +0000 (17:37 -0500)
commit8e9028b3790ddb02c407e1a4da0ab7cf82790e7e
tree4d47d8f4146693c6a91f18b236d446a98da93ea2
parente4e737bb5c170df6135a127739a9e6148ee3da82
PCI: Return NULL for to_pci_driver(NULL)

to_pci_driver() takes a pointer to a struct device_driver and uses
container_of() to find the struct pci_driver that contains it.

If given a NULL pointer to a struct device_driver, return a NULL pci_driver
pointer instead of applying container_of() to NULL.

This simplifies callers that would otherwise have to check for a NULL
pointer first.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
include/linux/pci.h