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: 1154ea7dcd
("[PATCH] Framebuffer driver for Arc LCD board")
Signed-off-by: Zongjie Li <u202112089@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
ac9a78681b
commit
5a6bef7342
@ -523,7 +523,7 @@ static int arcfb_probe(struct platform_device *dev)
|
|||||||
|
|
||||||
info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
|
info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
|
||||||
if (!info)
|
if (!info)
|
||||||
goto err;
|
goto err_fb_alloc;
|
||||||
|
|
||||||
info->screen_base = (char __iomem *)videomemory;
|
info->screen_base = (char __iomem *)videomemory;
|
||||||
info->fbops = &arcfb_ops;
|
info->fbops = &arcfb_ops;
|
||||||
@ -535,7 +535,7 @@ static int arcfb_probe(struct platform_device *dev)
|
|||||||
|
|
||||||
if (!dio_addr || !cio_addr || !c2io_addr) {
|
if (!dio_addr || !cio_addr || !c2io_addr) {
|
||||||
printk(KERN_WARNING "no IO addresses supplied\n");
|
printk(KERN_WARNING "no IO addresses supplied\n");
|
||||||
goto err1;
|
goto err_addr;
|
||||||
}
|
}
|
||||||
par->dio_addr = dio_addr;
|
par->dio_addr = dio_addr;
|
||||||
par->cio_addr = cio_addr;
|
par->cio_addr = cio_addr;
|
||||||
@ -551,12 +551,12 @@ static int arcfb_probe(struct platform_device *dev)
|
|||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"arcfb: Failed req IRQ %d\n", par->irq);
|
"arcfb: Failed req IRQ %d\n", par->irq);
|
||||||
retval = -EBUSY;
|
retval = -EBUSY;
|
||||||
goto err1;
|
goto err_addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = register_framebuffer(info);
|
retval = register_framebuffer(info);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
goto err1;
|
goto err_register_fb;
|
||||||
platform_set_drvdata(dev, info);
|
platform_set_drvdata(dev, info);
|
||||||
fb_info(info, "Arc frame buffer device, using %dK of video memory\n",
|
fb_info(info, "Arc frame buffer device, using %dK of video memory\n",
|
||||||
videomemorysize >> 10);
|
videomemorysize >> 10);
|
||||||
@ -580,9 +580,12 @@ static int arcfb_probe(struct platform_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err1:
|
|
||||||
|
err_register_fb:
|
||||||
|
free_irq(par->irq, info);
|
||||||
|
err_addr:
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
err:
|
err_fb_alloc:
|
||||||
vfree(videomemory);
|
vfree(videomemory);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user