[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190110132622.ni5lshjmhmsydaal@gondor.apana.org.au>
Date: Thu, 10 Jan 2019 21:26:22 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Aditya Pakki <pakki001@....edu>
Cc: kjlu@....edu, Matt Mackall <mpm@...enic.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Michael S. Tsirkin" <mst@...hat.com>, Michael Buesch <m@...s.ch>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] hwrng: core: Fix missing check during driver release
On Sun, Jan 06, 2019 at 11:26:12AM -0600, Aditya Pakki wrote:
> devres_release can return -ENOENT if the device is not freed. The fix
> throws a warning consistent with other invocations.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
> drivers/char/hw_random/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
> index 95be7228f327..1b05da40626a 100644
> --- a/drivers/char/hw_random/core.c
> +++ b/drivers/char/hw_random/core.c
> @@ -578,7 +578,8 @@ EXPORT_SYMBOL_GPL(devm_hwrng_register);
>
> void devm_hwrng_unregister(struct device *dev, struct hwrng *rng)
> {
> - devres_release(dev, devm_hwrng_release, devm_hwrng_match, rng);
> + WARN_ON(devres_release(dev, devm_hwrng_release,
> + devm_hwrng_match, rng));
Hmm please don't perform real operations within a WARN_ON. This
is potentially confusing to the reader. If you had to do this, do
it like
err = devres_release(...);
WARN_ON(err);
I'd also like to know under what circumstances can you get an
-ENOENT?
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists