summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-11-09 18:09:31 +0100
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2017-11-09 18:09:31 +0100
commit6b04e9f2564a609cfaebae1ff9556118f3ae0a2e (patch)
treecae07b53a8ed056cbcde1c5a4181fbdf504c408f /drivers/video
parentffb66624caa4db72e3a00aba8d27862395173b20 (diff)
downloadlinux-6b04e9f2564a609cfaebae1ff9556118f3ae0a2e.tar.bz2
video/fbdev/dnfb: Use common error handling code in dnfb_probe()
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/dnfb.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/video/fbdev/dnfb.c b/drivers/video/fbdev/dnfb.c
index 09415009d797..5505fa00c634 100644
--- a/drivers/video/fbdev/dnfb.c
+++ b/drivers/video/fbdev/dnfb.c
@@ -242,16 +242,13 @@ static int dnfb_probe(struct platform_device *dev)
info->screen_base = (u_char *) info->fix.smem_start;
err = fb_alloc_cmap(&info->cmap, 2, 0);
- if (err < 0) {
- framebuffer_release(info);
- return err;
- }
+ if (err < 0)
+ goto release_framebuffer;
err = register_framebuffer(info);
if (err < 0) {
fb_dealloc_cmap(&info->cmap);
- framebuffer_release(info);
- return err;
+ goto release_framebuffer;
}
platform_set_drvdata(dev, info);
@@ -265,6 +262,10 @@ static int dnfb_probe(struct platform_device *dev)
printk("apollo frame buffer alive and kicking !\n");
return err;
+
+release_framebuffer:
+ framebuffer_release(info);
+ return err;
}
static struct platform_driver dnfb_driver = {