Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49495d44 authored by Florian Mickler's avatar Florian Mickler Committed by Dave Airlie
Browse files

amd64-agp: fix crash at second module load



The module forgot to sometimes unregister some resources.

This fixes Bug #22882.

[Patch updated to 2.6.38-rc3 by Randy Dunlap.]
Tested-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarFlorian Mickler <florian@mickler.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 45e4039c
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -773,19 +773,24 @@ int __init agp_amd64_init(void)
#else
#else
			printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
			printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
#endif
#endif
			pci_unregister_driver(&agp_amd64_pci_driver);
			return -ENODEV;
			return -ENODEV;
		}
		}


		/* First check that we have at least one AMD64 NB */
		/* First check that we have at least one AMD64 NB */
		if (!pci_dev_present(amd_nb_misc_ids))
		if (!pci_dev_present(amd_nb_misc_ids)) {
			pci_unregister_driver(&agp_amd64_pci_driver);
			return -ENODEV;
			return -ENODEV;
		}


		/* Look for any AGP bridge */
		/* Look for any AGP bridge */
		agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table;
		agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table;
		err = driver_attach(&agp_amd64_pci_driver.driver);
		err = driver_attach(&agp_amd64_pci_driver.driver);
		if (err == 0 && agp_bridges_found == 0)
		if (err == 0 && agp_bridges_found == 0) {
			pci_unregister_driver(&agp_amd64_pci_driver);
			err = -ENODEV;
			err = -ENODEV;
		}
		}
	}
	return err;
	return err;
}
}