summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2014-11-14 13:26:49 +0100
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-11-14 14:28:39 +0100
commitbf2fda157a9ab50f65da60a365ede3a5b529d025 (patch)
tree8e8f1df828d61876101d4aeb7605c72ffc38bfef
parentsimplefb: formalize pseudo palette handling (diff)
downloadlinux-bf2fda157a9ab50f65da60a365ede3a5b529d025.tar.xz
linux-bf2fda157a9ab50f65da60a365ede3a5b529d025.zip
simplefb: add goto error path to probe
Use the usual kernel style of goto error_foo to free resources on probe error. This is a preparation patch for adding clocks support. While at it also update ioremap_wc error return from ENODEV to ENOMEM. Signed-off-by: Luc Verhaegen <libv@skynet.be> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/fbdev/simplefb.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index ec112c13eb05..cdcf1fe46eae 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -220,8 +220,8 @@ static int simplefb_probe(struct platform_device *pdev)
info->apertures = alloc_apertures(1);
if (!info->apertures) {
- framebuffer_release(info);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto error_fb_release;
}
info->apertures->ranges[0].base = info->fix.smem_start;
info->apertures->ranges[0].size = info->fix.smem_len;
@@ -231,8 +231,8 @@ static int simplefb_probe(struct platform_device *pdev)
info->screen_base = ioremap_wc(info->fix.smem_start,
info->fix.smem_len);
if (!info->screen_base) {
- framebuffer_release(info);
- return -ENODEV;
+ ret = -ENOMEM;
+ goto error_fb_release;
}
info->pseudo_palette = par->palette;
@@ -247,14 +247,18 @@ static int simplefb_probe(struct platform_device *pdev)
ret = register_framebuffer(info);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
- iounmap(info->screen_base);
- framebuffer_release(info);
- return ret;
+ goto error_unmap;
}
dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node);
return 0;
+
+error_unmap:
+ iounmap(info->screen_base);
+error_fb_release:
+ framebuffer_release(info);
+ return ret;
}
static int simplefb_remove(struct platform_device *pdev)