public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@hansjkoch.de>
To: Daeseok Youn <daeseok.youn@gmail.com>
Cc: hjk@hansjkoch.de, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: uio_dmem_genirq: Fix memory leak in uio_dmem_genirq_probe()
Date: Thu, 22 May 2014 16:47:58 +0200	[thread overview]
Message-ID: <20140522144758.GA4500@silverbox.local> (raw)
In-Reply-To: <20140522004611.GA1216@devel.8.8.4.4>

On Thu, May 22, 2014 at 09:46:12AM +0900, Daeseok Youn wrote:
> When platform_get_irq() is failed after "priv" allocated,
> it need to free "priv". But the label of bad0 doesn't try
> to free about "priv". So this patch changes that lable to "bad1".
> But "bad1" has pm_runtime_disable() call, this function should
> be called when uio_register_device() is failed. So it is moved
> into handling error for uio_register_device().

Looks alright to me. Thanks for your contribution.

Signed-off-by: Hans J. Koch <hjk@hansjkoch.de>

> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
>  drivers/uio/uio_dmem_genirq.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
> index 1270f3b..8d0bba4 100644
> --- a/drivers/uio/uio_dmem_genirq.c
> +++ b/drivers/uio/uio_dmem_genirq.c
> @@ -204,7 +204,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
>  		ret = platform_get_irq(pdev, 0);
>  		if (ret < 0) {
>  			dev_err(&pdev->dev, "failed to get IRQ\n");
> -			goto bad0;
> +			goto bad1;
>  		}
>  		uioinfo->irq = ret;
>  	}
> @@ -275,6 +275,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
>  	ret = uio_register_device(&pdev->dev, priv->uioinfo);
>  	if (ret) {
>  		dev_err(&pdev->dev, "unable to register uio device\n");
> +		pm_runtime_disable(&pdev->dev);
>  		goto bad1;
>  	}
>  
> @@ -282,7 +283,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
>  	return 0;
>   bad1:
>  	kfree(priv);
> -	pm_runtime_disable(&pdev->dev);
>   bad0:
>  	/* kfree uioinfo for OF */
>  	if (pdev->dev.of_node)
> -- 
> 1.7.1
> 
> 

      reply	other threads:[~2014-05-22 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22  0:46 [PATCH] drivers: uio_dmem_genirq: Fix memory leak in uio_dmem_genirq_probe() Daeseok Youn
2014-05-22 14:47 ` Hans J. Koch [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=20140522144758.GA4500@silverbox.local \
    --to=hjk@hansjkoch.de \
    --cc=daeseok.youn@gmail.com \
    --cc=gregkh@linuxfoundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox