Fix intelfb trying to free a non-existent resource in its error path.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/*** hw-related values ***/
/*** hw-related values ***/
+/* Resource Allocation */
+#define INTELFB_FB_ACQUIRED 1
+#define INTELFB_MMIO_ACQUIRED 2
+
/* PCI ids for supported devices */
#define PCI_DEVICE_ID_INTEL_830M 0x3577
#define PCI_DEVICE_ID_INTEL_845G 0x2562
/* PCI ids for supported devices */
#define PCI_DEVICE_ID_INTEL_830M 0x3577
#define PCI_DEVICE_ID_INTEL_845G 0x2562
int hwcursor;
int fixed_mode;
int ring_active;
int hwcursor;
int fixed_mode;
int ring_active;
/* hw cursor */
int cursor_on;
/* hw cursor */
int cursor_on;
if (dinfo->aperture.virtual)
iounmap((void __iomem *)dinfo->aperture.virtual);
if (dinfo->aperture.virtual)
iounmap((void __iomem *)dinfo->aperture.virtual);
- if (dinfo->mmio_base_phys)
+ if (dinfo->flag & INTELFB_MMIO_ACQUIRED)
release_mem_region(dinfo->mmio_base_phys, INTEL_REG_SIZE);
release_mem_region(dinfo->mmio_base_phys, INTEL_REG_SIZE);
- if (dinfo->aperture.physical)
+ if (dinfo->flag & INTELFB_FB_ACQUIRED)
release_mem_region(dinfo->aperture.physical,
dinfo->aperture.size);
framebuffer_release(dinfo->info);
release_mem_region(dinfo->aperture.physical,
dinfo->aperture.size);
framebuffer_release(dinfo->info);
cleanup(dinfo);
return -ENODEV;
}
cleanup(dinfo);
return -ENODEV;
}
+
+ dinfo->flag |= INTELFB_FB_ACQUIRED;
+
if (!request_mem_region(dinfo->mmio_base_phys,
INTEL_REG_SIZE,
INTELFB_MODULE_NAME)) {
if (!request_mem_region(dinfo->mmio_base_phys,
INTEL_REG_SIZE,
INTELFB_MODULE_NAME)) {
+ dinfo->flag |= INTELFB_MMIO_ACQUIRED;
+
/* Get the chipset info. */
dinfo->pci_chipset = pdev->device;
/* Get the chipset info. */
dinfo->pci_chipset = pdev->device;