Skip to content

Commit 5a6bef7

Browse files
Zongjie Lihdeller
authored andcommitted
fbdev: arcfb: Fix error handling in arcfb_probe()
Smatch complains that: arcfb_probe() warn: 'irq' from request_irq() not released on lines: 587. Fix error handling in the arcfb_probe() function. If IO addresses are not provided or framebuffer registration fails, the code will jump to the err_addr or err_register_fb label to release resources. If IRQ request fails, previously allocated resources will be freed. Fixes: 1154ea7 ("[PATCH] Framebuffer driver for Arc LCD board") Signed-off-by: Zongjie Li <[email protected]> Reviewed-by: Dongliang Mu <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent ac9a786 commit 5a6bef7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/video/fbdev/arcfb.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static int arcfb_probe(struct platform_device *dev)
523523

524524
info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
525525
if (!info)
526-
goto err;
526+
goto err_fb_alloc;
527527

528528
info->screen_base = (char __iomem *)videomemory;
529529
info->fbops = &arcfb_ops;
@@ -535,7 +535,7 @@ static int arcfb_probe(struct platform_device *dev)
535535

536536
if (!dio_addr || !cio_addr || !c2io_addr) {
537537
printk(KERN_WARNING "no IO addresses supplied\n");
538-
goto err1;
538+
goto err_addr;
539539
}
540540
par->dio_addr = dio_addr;
541541
par->cio_addr = cio_addr;
@@ -551,12 +551,12 @@ static int arcfb_probe(struct platform_device *dev)
551551
printk(KERN_INFO
552552
"arcfb: Failed req IRQ %d\n", par->irq);
553553
retval = -EBUSY;
554-
goto err1;
554+
goto err_addr;
555555
}
556556
}
557557
retval = register_framebuffer(info);
558558
if (retval < 0)
559-
goto err1;
559+
goto err_register_fb;
560560
platform_set_drvdata(dev, info);
561561
fb_info(info, "Arc frame buffer device, using %dK of video memory\n",
562562
videomemorysize >> 10);
@@ -580,9 +580,12 @@ static int arcfb_probe(struct platform_device *dev)
580580
}
581581

582582
return 0;
583-
err1:
583+
584+
err_register_fb:
585+
free_irq(par->irq, info);
586+
err_addr:
584587
framebuffer_release(info);
585-
err:
588+
err_fb_alloc:
586589
vfree(videomemory);
587590
return retval;
588591
}

0 commit comments

Comments
 (0)