[PATCH] fix improper use of pci_module_init() in drivers/char/agp/amd64-agp.c

From: Greg KH (greg_at_kroah.com)
Date: 09/30/04

  • Next message: Bill Davidsen: "Re: mmap() on cdrom files fails in 2.6.9-rc2-mmX"
    Date:	Thu, 30 Sep 2004 11:42:48 -0700
    To: davej@codemonkey.org.uk, ak@suse.de
    
    

    Hi,

    In going through the tree and auditing the usage of pci_module_init(), I
    noticed that the amd64-agp driver was assuming that the return value of
    this function could be greater than 0 (which is what could happen in 2.2
    and 2.4 kernels.) As this is no longer true, I think the following
    patch is correct.

    I can add this to my bk-pci tree if you wish, otherwise feel free to
    send it upwards.

    thanks,

    greg k-h

    -----

    AGP: Fix up pci_module_init() usage in amd64-agp.c

    pci_module_init() can not return a positive number in the 2.6 kernel, so
    this code path was never getting run, so might as well just delete it.

    Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

    --- a/drivers/char/agp/amd64-agp.c 2004-08-24 07:55:13 -07:00
    +++ b/drivers/char/agp/amd64-agp.c 2004-09-30 11:37:35 -07:00
    @@ -624,39 +624,9 @@
     /* Not static due to IOMMU code calling it early. */
     int __init agp_amd64_init(void)
     {
    - int err = 0;
             if (agp_off)
                     return -EINVAL;
    - if (pci_module_init(&agp_amd64_pci_driver) > 0) {
    - struct pci_dev *dev;
    - if (!agp_try_unsupported && !agp_try_unsupported_boot) {
    - printk(KERN_INFO PFX "No supported AGP bridge found.\n");
    -#ifdef MODULE
    - printk(KERN_INFO PFX "You can try agp_try_unsupported=1\n");
    -#else
    - printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
    -#endif
    - return -ENODEV;
    - }
    -
    - /* First check that we have at least one AMD64 NB */
    - if (!pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, NULL))
    - return -ENODEV;
    -
    - /* Look for any AGP bridge */
    - dev = NULL;
    - err = -ENODEV;
    - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) {
    - if (!pci_find_capability(dev, PCI_CAP_ID_AGP))
    - continue;
    - /* Only one bridge supported right now */
    - if (agp_amd64_probe(dev, NULL) == 0) {
    - err = 0;
    - break;
    - }
    - }
    - }
    - return err;
    + return pci_register_driver(&agp_amd64_pci_driver);
     }
     
     static void __exit agp_amd64_cleanup(void)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Bill Davidsen: "Re: mmap() on cdrom files fails in 2.6.9-rc2-mmX"

    Relevant Pages

    • Re: [ACPI] [PATCH] PNPACPI: fix types when decoding ACPI resources [resend]
      ... I was just based off a Linus tree, non -mm, ... and didn't notice that your patch conflicted. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH 3/5] Free sysfs_dirent on file removal
      ... It uses the sysfs_dirent based tree in order ... it doesnot use dentry based tree. ... static void remove_dir ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH] Add sysfs support for the IPMI device interface
      ... Andrew because he has a rework of this in his tree that has not made it ... static void ipmi_smi_gone ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [patch /proc] Speedup /proc/pid/maps
      ... Even if mmap_cache does not match, rb tree walk should be faster than sequential ... Later got inspiration from wli's pid patch using f_version in readdir of /proc. ... static void m_stop ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: kgdb for mainline kernel: core-lite [patch 1/3]
      ... This feature lets gdb hook onto a kernel function to detect loading and ... unloading of modules and preserves module section information for later use ... The one in my tree also apparently works to some ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)