aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/carminefb.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2011-01-02 09:27:42 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-06 01:46:56 -0500
commite045da7d835a28950543f5f10f0cb1905ca9bbaf (patch)
tree49b70bb5ec592f2638804943f3c87218340002a5 /drivers/video/carminefb.c
parent7ee04fd5d5ff74f81d8eee128bc9346ab87c56b8 (diff)
drivers/video/carminefb.c: improve error handling
This code had an error handling goto to the wrong place, a misplaced release_mem_region, and a duplicated release_mem_region. The semantic match that finds the double release_mem_region is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ expression e1,e2,e3; position p1,p2,p3; @@ release_mem_region@p1(e1, e2)@p3; ... when != request_mem_region(e1,e2,e3) release_mem_region(e1, e2)@p2; @@ expression e <= r.e1,e3; expression r.e1,e2; position r.p1,r.p2,r.p3,p!=r.p1; @@ *release_mem_region(e1, e2)@p3; ... when != e = e3 *release_mem_region@p(e1, e2)@p2;// </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/carminefb.c')
-rw-r--r--drivers/video/carminefb.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/video/carminefb.c b/drivers/video/carminefb.c
index 6b19136aa181..caaa27d4a46a 100644
--- a/drivers/video/carminefb.c
+++ b/drivers/video/carminefb.c
@@ -654,7 +654,7 @@ static int __devinit carminefb_probe(struct pci_dev *dev,
654 printk(KERN_ERR "carminefb: Memory bar is only %d bytes, %d " 654 printk(KERN_ERR "carminefb: Memory bar is only %d bytes, %d "
655 "are required.", carminefb_fix.smem_len, 655 "are required.", carminefb_fix.smem_len,
656 CARMINE_TOTAL_DIPLAY_MEM); 656 CARMINE_TOTAL_DIPLAY_MEM);
657 goto err_free_reg_mmio; 657 goto err_unmap_vregs;
658 } 658 }
659 659
660 if (!request_mem_region(carminefb_fix.smem_start, 660 if (!request_mem_region(carminefb_fix.smem_start,
@@ -667,8 +667,6 @@ static int __devinit carminefb_probe(struct pci_dev *dev,
667 carminefb_fix.smem_len); 667 carminefb_fix.smem_len);
668 if (!hw->screen_mem) { 668 if (!hw->screen_mem) {
669 printk(KERN_ERR "carmine: Can't ioremap smem area.\n"); 669 printk(KERN_ERR "carmine: Can't ioremap smem area.\n");
670 release_mem_region(carminefb_fix.smem_start,
671 carminefb_fix.smem_len);
672 goto err_reg_smem; 670 goto err_reg_smem;
673 } 671 }
674 672
@@ -710,7 +708,7 @@ err_deinit_hw:
710err_unmap_screen: 708err_unmap_screen:
711 iounmap(hw->screen_mem); 709 iounmap(hw->screen_mem);
712err_reg_smem: 710err_reg_smem:
713 release_mem_region(carminefb_fix.mmio_start, carminefb_fix.mmio_len); 711 release_mem_region(carminefb_fix.smem_start, carminefb_fix.smem_len);
714err_unmap_vregs: 712err_unmap_vregs:
715 iounmap(hw->v_regs); 713 iounmap(hw->v_regs);
716err_free_reg_mmio: 714err_free_reg_mmio: