diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-11-12 02:10:18 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-11-12 02:10:18 +0300 |
commit | 5833291ab6de9c3e2374336b51c814e515e8f3a5 (patch) | |
tree | 65eaac2536356b0741266926ae70b2924d2565d3 /drivers/pci/pci.c | |
parent | ca2ef2d9f2aad7a28d346522bb4c473a0aa05249 (diff) | |
parent | e0217c5ba10d7bf640f038b2feae58e630f2f958 (diff) | |
download | linux-5833291ab6de9c3e2374336b51c814e515e8f3a5.tar.xz |
Merge tag 'pci-v5.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas:
"Revert conversion to struct device.driver instead of struct
pci_dev.driver.
The device.driver is set earlier, and using it caused the PCI core to
call driver PM entry points before .probe() and after .remove(), when
the driver isn't prepared.
This caused NULL pointer dereferences in i2c_designware_pci and
probably other driver issues"
* tag 'pci-v5.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
Revert "PCI: Use to_pci_driver() instead of pci_dev->driver"
Revert "PCI: Remove struct pci_dev->driver"
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f2cd11130737..1579a3724eb4 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5135,14 +5135,13 @@ EXPORT_SYMBOL_GPL(pci_dev_unlock); static void pci_dev_save_and_disable(struct pci_dev *dev) { - struct pci_driver *drv = to_pci_driver(dev->dev.driver); const struct pci_error_handlers *err_handler = - drv ? drv->err_handler : NULL; + dev->driver ? dev->driver->err_handler : NULL; /* - * drv->err_handler->reset_prepare() is protected against races - * with ->remove() by the device lock, which must be held by the - * caller. + * dev->driver->err_handler->reset_prepare() is protected against + * races with ->remove() by the device lock, which must be held by + * the caller. */ if (err_handler && err_handler->reset_prepare) err_handler->reset_prepare(dev); @@ -5167,15 +5166,15 @@ static void pci_dev_save_and_disable(struct pci_dev *dev) static void pci_dev_restore(struct pci_dev *dev) { - struct pci_driver *drv = to_pci_driver(dev->dev.driver); const struct pci_error_handlers *err_handler = - drv ? drv->err_handler : NULL; + dev->driver ? dev->driver->err_handler : NULL; pci_restore_state(dev); /* - * drv->err_handler->reset_done() is protected against races with - * ->remove() by the device lock, which must be held by the caller. + * dev->driver->err_handler->reset_done() is protected against + * races with ->remove() by the device lock, which must be held by + * the caller. */ if (err_handler && err_handler->reset_done) err_handler->reset_done(dev); |