提交 bf2fda15 编写于 作者: L Luc Verhaegen 提交者: Tomi Valkeinen

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: NLuc Verhaegen <libv@skynet.be>
Acked-by: NStephen Warren <swarren@nvidia.com>
Reviewed-by: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
Acked-by: NGrant Likely <grant.likely@linaro.org>
Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
上级 1270be4a
...@@ -220,8 +220,8 @@ static int simplefb_probe(struct platform_device *pdev) ...@@ -220,8 +220,8 @@ static int simplefb_probe(struct platform_device *pdev)
info->apertures = alloc_apertures(1); info->apertures = alloc_apertures(1);
if (!info->apertures) { if (!info->apertures) {
framebuffer_release(info); ret = -ENOMEM;
return -ENOMEM; goto error_fb_release;
} }
info->apertures->ranges[0].base = info->fix.smem_start; info->apertures->ranges[0].base = info->fix.smem_start;
info->apertures->ranges[0].size = info->fix.smem_len; info->apertures->ranges[0].size = info->fix.smem_len;
...@@ -231,8 +231,8 @@ static int simplefb_probe(struct platform_device *pdev) ...@@ -231,8 +231,8 @@ static int simplefb_probe(struct platform_device *pdev)
info->screen_base = ioremap_wc(info->fix.smem_start, info->screen_base = ioremap_wc(info->fix.smem_start,
info->fix.smem_len); info->fix.smem_len);
if (!info->screen_base) { if (!info->screen_base) {
framebuffer_release(info); ret = -ENOMEM;
return -ENODEV; goto error_fb_release;
} }
info->pseudo_palette = par->palette; info->pseudo_palette = par->palette;
...@@ -247,14 +247,18 @@ static int simplefb_probe(struct platform_device *pdev) ...@@ -247,14 +247,18 @@ static int simplefb_probe(struct platform_device *pdev)
ret = register_framebuffer(info); ret = register_framebuffer(info);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
iounmap(info->screen_base); goto error_unmap;
framebuffer_release(info);
return ret;
} }
dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node);
return 0; return 0;
error_unmap:
iounmap(info->screen_base);
error_fb_release:
framebuffer_release(info);
return ret;
} }
static int simplefb_remove(struct platform_device *pdev) static int simplefb_remove(struct platform_device *pdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册