]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit2f6cf652e8e09338c107b3489ad3e1636c0487bd
tree4d47d8f4146693c6a91f18b236d446a98da93ea2
parent77c55e5e0599360cc5f212ae9b228ab6c429f652
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