[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANc+2y6Scy1=S7zeQ4gVowRoWmzsq4wiNXbLVeY1Qvu0oo9cUw@mail.gmail.com>
Date: Wed, 12 Feb 2020 21:43:55 +0530
From: PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>
To: Martin Kaiser <martin@...ser.cx>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
NXP Linux Team <linux-imx@....com>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/6] hwrng: imx-rngc - use devres for registration
Hi Martin,
On Tue, 28 Jan 2020 at 16:31, Martin Kaiser <martin@...ser.cx> wrote:
>
> Use devres to register the rngc with the hwrng core. Drop the explicit
> deregistration.
>
> Signed-off-by: Martin Kaiser <martin@...ser.cx>
> ---
> drivers/char/hw_random/imx-rngc.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
> index 903894518c8d..1381ddd5b891 100644
> --- a/drivers/char/hw_random/imx-rngc.c
> +++ b/drivers/char/hw_random/imx-rngc.c
> @@ -263,7 +263,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
> }
> }
>
> - ret = hwrng_register(&rngc->rng);
> + ret = devm_hwrng_register(&pdev->dev, &rngc->rng);
> if (ret) {
> dev_err(&pdev->dev, "FSL RNGC registering failed (%d)\n", ret);
> goto err;
> @@ -282,8 +282,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev)
> {
> struct imx_rngc *rngc = platform_get_drvdata(pdev);
>
> - hwrng_unregister(&rngc->rng);
> -
> clk_disable_unprepare(rngc->clk);
>
> return 0;
> --
> 2.20.1
>
After imx_rngc_remove function hwrng_unregister will get called. This
leaves a window where the clock to rng hardware block is disabled but
still user space can access it via /dev/hwrng. This does not look
right, please revisit the patch.
Regards,
PrasannaKumar
Powered by blists - more mailing lists