]> git.hungrycats.org Git - linux/commitdiff
[AGPGART] Fix a potential leak in intel driver.
authorDave Jones <davej@redhat.com>
Sun, 23 May 2004 14:02:45 +0000 (15:02 +0100)
committerDave Jones <davej@delerium.codemonkey.org.uk>
Sun, 23 May 2004 14:02:45 +0000 (15:02 +0100)
It's not leaking anything currently, as agp_alloc_bridge() doesn't do any
actual allocations right now, but if/when things get changed to support
multiple bridges, these error paths need to free up the allocation.

drivers/char/agp/intel-agp.c

index f57ceeb6af8b3ca13e95679eb8dd5659acaa642f..5d3a0ceca25b31d0f0679a9fab5f08b6ad7f3902 100644 (file)
@@ -1233,7 +1233,7 @@ static int find_i810(u16 device, const char *name)
                                name);
                return 0;
        }
-       
+
        intel_i810_private.i810_dev = i810_dev;
        return 1;
 }
@@ -1384,6 +1384,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        default:
                printk(KERN_ERR PFX "Unsupported Intel chipset (device id: %04x)\n",
                            pdev->device);
+               agp_put_bridge(bridge);
                return -ENODEV;
        };
 
@@ -1406,7 +1407,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        if (!r->start && r->end) {
                if(pci_assign_resource(pdev, 0)) {
                        printk(KERN_ERR PFX "could not assign resource 0\n");
-                       return (-ENODEV);
+                       agp_put_bridge(bridge);
+                       return -ENODEV;
                }
        }
 
@@ -1417,7 +1419,8 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        */
        if (pci_enable_device(pdev)) {
                printk(KERN_ERR PFX "Unable to Enable PCI device\n");
-               return (-ENODEV);
+               agp_put_bridge(bridge);
+               return -ENODEV;
        }
 
        /* Fill in the mode register */