lkml.org 
[lkml]   [2004]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] fix improper use of pci_module_init() in drivers/char/agp/amd64-agp.c
    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/
    \
     
     \ /
      Last update: 2005-03-22 14:06    [W:0.023 / U:32.784 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site