mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Zongjie Li <u202112089@hust.edu.cn>, Andrew Morton <akpm@osdl.org>
Cc: hust-os-kernel-patches@googlegroups.com,
	Dongliang Mu <dzm91@hust.edu.cn>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: fbdev: arcfb: Fix error handling in arcfb_probe()
Date: Thu, 11 May 2023 17:55:39 +0200	[thread overview]
Message-ID: <b7e5e4b9-a0c9-96aa-e264-a8ccfac5a768@gmx.de> (raw)
In-Reply-To: <20230509112727.3899-1-u202112089@hust.edu.cn>

On 5/9/23 13:27, Zongjie Li wrote:
> Smatch complains that:
> arcfb_probe() warn: 'irq' from request_irq() not released on lines: 587.
>
> Fix error handling in the arcfb_probe() function. If IO addresses are
> not provided or framebuffer registration fails, the code will jump to
> the err_addr or err_register_fb label to release resources.
> If IRQ request fails, previously allocated resources will be freed.
>
> Fixes: 1154ea7dcd8e ("[PATCH] Framebuffer driver for Arc LCD board")
> Signed-off-by: Zongjie Li <u202112089@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>

applied.

Thanks!
Helge

> ---
>   drivers/video/fbdev/arcfb.c | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c
> index 45e64016db32..024d0ee4f04f 100644
> --- a/drivers/video/fbdev/arcfb.c
> +++ b/drivers/video/fbdev/arcfb.c
> @@ -523,7 +523,7 @@ static int arcfb_probe(struct platform_device *dev)
>
>   	info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
>   	if (!info)
> -		goto err;
> +		goto err_fb_alloc;
>
>   	info->screen_base = (char __iomem *)videomemory;
>   	info->fbops = &arcfb_ops;
> @@ -535,7 +535,7 @@ static int arcfb_probe(struct platform_device *dev)
>
>   	if (!dio_addr || !cio_addr || !c2io_addr) {
>   		printk(KERN_WARNING "no IO addresses supplied\n");
> -		goto err1;
> +		goto err_addr;
>   	}
>   	par->dio_addr = dio_addr;
>   	par->cio_addr = cio_addr;
> @@ -551,12 +551,12 @@ static int arcfb_probe(struct platform_device *dev)
>   			printk(KERN_INFO
>   				"arcfb: Failed req IRQ %d\n", par->irq);
>   			retval = -EBUSY;
> -			goto err1;
> +			goto err_addr;
>   		}
>   	}
>   	retval = register_framebuffer(info);
>   	if (retval < 0)
> -		goto err1;
> +		goto err_register_fb;
>   	platform_set_drvdata(dev, info);
>   	fb_info(info, "Arc frame buffer device, using %dK of video memory\n",
>   		videomemorysize >> 10);
> @@ -580,9 +580,12 @@ static int arcfb_probe(struct platform_device *dev)
>   	}
>
>   	return 0;
> -err1:
> +
> +err_register_fb:
> +	free_irq(par->irq, info);
> +err_addr:
>   	framebuffer_release(info);
> -err:
> +err_fb_alloc:
>   	vfree(videomemory);
>   	return retval;
>   }


      reply	other threads:[~2023-05-11 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 11:27 Zongjie Li
2023-05-11 15:55 ` Helge Deller [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=b7e5e4b9-a0c9-96aa-e264-a8ccfac5a768@gmx.de \
    --to=deller@gmx.de \
    --cc=akpm@osdl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dzm91@hust.edu.cn \
    --cc=hust-os-kernel-patches@googlegroups.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u202112089@hust.edu.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®