linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhou Yanjie <zhouyanjie@wanyeetech.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	mpm@selenic.com, herbert@gondor.apana.org.au,
	aric.pzqi@ingenic.com
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hwrng: ingenic - Fix a resource leak in an error handling path
Date: Sun, 20 Dec 2020 21:30:27 +0800	[thread overview]
Message-ID: <c5bb8f9a-c4a7-7ecb-eccb-a31abc7316a2@wanyeetech.com> (raw)
In-Reply-To: <20201219075207.176279-1-christophe.jaillet@wanadoo.fr>

Hi Christophe,

On 2020/12/19 下午3:52, Christophe JAILLET wrote:
> In case of error, we should call 'clk_disable_unprepare()' to undo a
> previous 'clk_prepare_enable()' call, as already done in the remove
> function.
>
> Fixes: 406346d22278 ("hwrng: ingenic - Add hardware TRNG for Ingenic X1830")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>   drivers/char/hw_random/ingenic-trng.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)


Thanks for fixing it, and apologize for my carelessness.

Tested-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>


> diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c
> index 954a8411d67d..0eb80f786f4d 100644
> --- a/drivers/char/hw_random/ingenic-trng.c
> +++ b/drivers/char/hw_random/ingenic-trng.c
> @@ -113,13 +113,17 @@ static int ingenic_trng_probe(struct platform_device *pdev)
>   	ret = hwrng_register(&trng->rng);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Failed to register hwrng\n");
> -		return ret;
> +		goto err_unprepare_clk;
>   	}
>   
>   	platform_set_drvdata(pdev, trng);
>   
>   	dev_info(&pdev->dev, "Ingenic DTRNG driver registered\n");
>   	return 0;
> +
> +err_unprepare_clk:
> +	clk_disable_unprepare(trng->clk);
> +	return ret;
>   }
>   
>   static int ingenic_trng_remove(struct platform_device *pdev)

  reply	other threads:[~2020-12-20 13:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19  7:52 [PATCH] hwrng: ingenic - Fix a resource leak in an error handling path Christophe JAILLET
2020-12-20 13:30 ` Zhou Yanjie [this message]
2021-01-02 22:08 ` Herbert Xu

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=c5bb8f9a-c4a7-7ecb-eccb-a31abc7316a2@wanyeetech.com \
    --to=zhouyanjie@wanyeetech.com \
    --cc=aric.pzqi@ingenic.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /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;
as well as URLs for NNTP newsgroup(s).