metronomefb: don't free firmware twice in error path
authorSebastian Siewior <frame+buffer@ml.breakpoint.cc>
Mon, 28 Apr 2008 09:15:39 +0000 (02:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:41 +0000 (08:58 -0700)
Right now, if request_irq or anthing after it fails than we free the firmware
for the second time what might end bad :)

Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
Acked-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/metronomefb.c

index 17066dd5a1901d521ce7e6e98dfb3da5e3742445..249791286367ea934b6d149799d1571b0b6e13c7 100644 (file)
@@ -671,14 +671,14 @@ static int __devinit metronomefb_probe(struct platform_device *dev)
 
        retval = load_waveform((u8 *) fw_entry->data, fw_entry->size,
                                par->metromem_wfm, 3, 31, &par->frame_count);
+       release_firmware(fw_entry);
        if (retval < 0) {
                printk(KERN_ERR "metronomefb: couldn't process waveform\n");
-               goto err_ld_wfm;
+               goto err_dma_free;
        }
-       release_firmware(fw_entry);
 
        if (board->setup_irq(info))
-               goto err_ld_wfm;
+               goto err_dma_free;
 
        retval = metronome_init_regs(par);
        if (retval < 0)
@@ -719,8 +719,6 @@ err_fb_rel:
        framebuffer_release(info);
 err_free_irq:
        board->free_irq(info);
-err_ld_wfm:
-       release_firmware(fw_entry);
 err_dma_free:
        dma_free_writecombine(&dev->dev, par->metromemsize, par->metromem,
                                par->metromem_dma);