Commit b8e20524 authored by Dave Jones's avatar Dave Jones

[AGPGART] fix pci_get_device conversion in intel-agp

- any device teardown must happen between agp_remove_bridge and
  agp_put_bridge, before agp_remove_bridge users can still call into
  the code
- it's releasing a reference to the wrong device

Original patch from: Christoph Hellwig
Further munging from Roland Dreier and myself.
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 5d58dea4
...@@ -1730,8 +1730,13 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) ...@@ -1730,8 +1730,13 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
{ {
struct agp_bridge_data *bridge = pci_get_drvdata(pdev); struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
pci_dev_put(pdev);
agp_remove_bridge(bridge); agp_remove_bridge(bridge);
if (intel_i810_private.i810_dev)
pci_dev_put(intel_i810_private.i810_dev);
if (intel_i830_private.i830_dev)
pci_dev_put(intel_i830_private.i830_dev);
agp_put_bridge(bridge); agp_put_bridge(bridge);
} }
......
...@@ -569,15 +569,16 @@ static void __devexit agp_intelmch_remove(struct pci_dev *pdev) ...@@ -569,15 +569,16 @@ static void __devexit agp_intelmch_remove(struct pci_dev *pdev)
{ {
struct agp_bridge_data *bridge = pci_get_drvdata(pdev); struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
pci_dev_put(pdev);
agp_remove_bridge(bridge); agp_remove_bridge(bridge);
if (intel_i830_private.i830_dev)
pci_dev_put(intel_i830_private.i830_dev);
agp_put_bridge(bridge); agp_put_bridge(bridge);
} }
static int agp_intelmch_resume(struct pci_dev *pdev) static int agp_intelmch_resume(struct pci_dev *pdev)
{ {
struct agp_bridge_data *bridge = pci_get_drvdata(pdev); struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
pci_restore_state(pdev); pci_restore_state(pdev);
if (bridge->driver == &intel_845_driver) if (bridge->driver == &intel_845_driver)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment