[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181226230301.7eb74756@wiggum>
Date: Wed, 26 Dec 2018 23:03:01 +0100
From: Michael Büsch <m@...s.ch>
To: Aditya Pakki <pakki001@....edu>
Cc: kjlu@....edu, Matt Mackall <mpm@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] char: hw_random: Fix missing check during driver
release
On Wed, 26 Dec 2018 11:23:31 -0600
Aditya Pakki <pakki001@....edu> 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 | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
> index 95be7228f327..582d983fa93f 100644
> --- a/drivers/char/hw_random/core.c
> +++ b/drivers/char/hw_random/core.c
> @@ -578,7 +578,11 @@ 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);
> + int rc;
> +
> + rc = devres_release(dev, devm_hwrng_release, devm_hwrng_match, rng);
> + if (rc)
The if statement is redundant and can be removed.
> + WARN_ON(rc);
> }
> EXPORT_SYMBOL_GPL(devm_hwrng_unregister);
>
--
Michael
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists