From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Emil Goode <emilgoode@gmail.com>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] video: hpfb: Fix error handling
Date: Sun, 23 Sep 2012 19:23:07 +0000 [thread overview]
Message-ID: <505F619B.80505@gmx.de> (raw)
In-Reply-To: <1345487545-9590-1-git-send-email-emilgoode@gmail.com>
On 08/20/2012 06:32 PM, Emil Goode wrote:
> This patch solves problems with the error handling by
> introducing labels for proper error paths and it also
> frees resources that where missed.
>
> Signed-off-by: Emil Goode <emilgoode@gmail.com>
Applied.
Thanks,
Florian Tobias Schandinat
> ---
> drivers/video/hpfb.c | 28 +++++++++++++++++++++-------
> 1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c
> index ebf8495..7324865 100644
> --- a/drivers/video/hpfb.c
> +++ b/drivers/video/hpfb.c
> @@ -210,6 +210,7 @@ static int __devinit hpfb_init_one(unsigned long phys_base,
> unsigned long virt_base)
> {
> unsigned long fboff, fb_width, fb_height, fb_start;
> + int ret;
>
> fb_regs = virt_base;
> fboff = (in_8(fb_regs + HPFB_FBOMSB) << 8) | in_8(fb_regs + HPFB_FBOLSB);
> @@ -290,19 +291,29 @@ static int __devinit hpfb_init_one(unsigned long phys_base,
> fb_info.var = hpfb_defined;
> fb_info.screen_base = (char *)fb_start;
>
> - fb_alloc_cmap(&fb_info.cmap, 1 << hpfb_defined.bits_per_pixel, 0);
> + ret = fb_alloc_cmap(&fb_info.cmap, 1 << hpfb_defined.bits_per_pixel, 0);
> + if (ret < 0)
> + goto unmap_screen_base;
>
> - if (register_framebuffer(&fb_info) < 0) {
> - fb_dealloc_cmap(&fb_info.cmap);
> - iounmap(fb_info.screen_base);
> - fb_info.screen_base = NULL;
> - return 1;
> - }
> + ret = register_framebuffer(&fb_info);
> + if (ret < 0)
> + goto dealloc_cmap;
>
> printk(KERN_INFO "fb%d: %s frame buffer device\n",
> fb_info.node, fb_info.fix.id);
>
> return 0;
> +
> +dealloc_cmap:
> + fb_dealloc_cmap(&fb_info.cmap);
> +
> +unmap_screen_base:
> + if (fb_info.screen_base) {
> + iounmap(fb_info.screen_base);
> + fb_info.screen_base = NULL;
> + }
> +
> + return ret;
> }
>
> /*
> @@ -345,6 +356,9 @@ static void __devexit hpfb_remove_one(struct dio_dev *d)
> if (d->scode >= DIOII_SCBASE)
> iounmap((void *)fb_regs);
> release_mem_region(d->resource.start, resource_size(&d->resource));
> + fb_dealloc_cmap(&fb_info.cmap);
> + if (fb_info.screen_base)
> + iounmap(fb_info.screen_base);
> }
>
> static struct dio_device_id hpfb_dio_tbl[] = {
prev parent reply other threads:[~2012-09-23 19:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-20 18:32 [PATCH] video: hpfb: Fix error handling Emil Goode
2012-08-20 18:32 ` Emil Goode
2012-09-23 19:23 ` Florian Tobias Schandinat [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=505F619B.80505@gmx.de \
--to=florianschandinat@gmx.de \
--cc=emilgoode@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.