Thread (269 messages) 269 messages, 18 authors, 2014-11-11

[PATCH 2/4] simplefb: add goto error path to probe

From: David Herrmann <hidden>
Date: 2014-08-13 07:27:46
Also in: linux-fbdev

Hi

On Wed, Aug 13, 2014 at 9:17 AM, Luc Verhaegen [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Luc Verhaegen <redacted>
---
 drivers/video/fbdev/simplefb.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index 32be590..72a4f20 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 = -ENODEV;
+               goto error_fb_release;
        }
        info->pseudo_palette = (void *) par->palette;
@@ -247,14 +247,20 @@ 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;
Again, I'd use different coding-style, but I will leave that to
Stephen and Tomi:

Reviewed-by: David Herrmann <redacted>

Thanks
David
 }

 static int simplefb_remove(struct platform_device *pdev)
--
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help