kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe()
@ 2022-08-30  3:13 Sun Ke
  2022-08-30  4:01 ` Neal Liu
  2022-09-09  9:07 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Sun Ke @ 2022-08-30  3:13 UTC (permalink / raw)
  To: neal_liu, herbert, davem, joel
  Cc: linux-aspeed, linux-crypto, linux-arm-kernel, kernel-janitors, sunke32

In case of error, the function devm_ioremap_resource() returns
ERR_PTR() not NULL. The NULL test in the return value check must be
replaced with IS_ERR().

Fixes: 108713a713c7 ("crypto: aspeed - Add HACE hash driver")
Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 drivers/crypto/aspeed/aspeed-hace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/aspeed/aspeed-hace.c b/drivers/crypto/aspeed/aspeed-hace.c
index 4fefc9e69d72..3f880aafb6a2 100644
--- a/drivers/crypto/aspeed/aspeed-hace.c
+++ b/drivers/crypto/aspeed/aspeed-hace.c
@@ -123,9 +123,9 @@ static int aspeed_hace_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, hace_dev);
 
 	hace_dev->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (!hace_dev->regs) {
+	if (IS_ERR(hace_dev->regs)) {
 		dev_err(&pdev->dev, "Failed to map resources\n");
-		return -ENOMEM;
+		return PTR_ERR(hace_dev->regs);
 	}
 
 	/* Get irq number and register it */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe()
  2022-08-30  3:13 [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe() Sun Ke
@ 2022-08-30  4:01 ` Neal Liu
  2022-09-09  9:07 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Neal Liu @ 2022-08-30  4:01 UTC (permalink / raw)
  To: Sun Ke, herbert, davem, joel
  Cc: linux-aspeed, linux-crypto, linux-arm-kernel, kernel-janitors

> -----Original Message-----
> From: Sun Ke <sunke32@huawei.com>
> Sent: Tuesday, August 30, 2022 11:14 AM
> To: Neal Liu <neal_liu@aspeedtech.com>; herbert@gondor.apana.org.au;
> davem@davemloft.net; joel@jms.id.au
> Cc: linux-aspeed@lists.ozlabs.org; linux-crypto@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; kernel-janitors@vger.kernel.org;
> sunke32@huawei.com
> Subject: [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe()
> 
> In case of error, the function devm_ioremap_resource() returns
> ERR_PTR() not NULL. The NULL test in the return value check must be replaced
> with IS_ERR().
> 
> Fixes: 108713a713c7 ("crypto: aspeed - Add HACE hash driver")
> Signed-off-by: Sun Ke <sunke32@huawei.com>

Thanks for the fix.
Reviewed-by: Neal Liu<neal_liu@aspeedtech.com>

> ---
>  drivers/crypto/aspeed/aspeed-hace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/aspeed/aspeed-hace.c
> b/drivers/crypto/aspeed/aspeed-hace.c
> index 4fefc9e69d72..3f880aafb6a2 100644
> --- a/drivers/crypto/aspeed/aspeed-hace.c
> +++ b/drivers/crypto/aspeed/aspeed-hace.c
> @@ -123,9 +123,9 @@ static int aspeed_hace_probe(struct platform_device
> *pdev)
>  	platform_set_drvdata(pdev, hace_dev);
> 
>  	hace_dev->regs = devm_ioremap_resource(&pdev->dev, res);
> -	if (!hace_dev->regs) {
> +	if (IS_ERR(hace_dev->regs)) {
>  		dev_err(&pdev->dev, "Failed to map resources\n");
> -		return -ENOMEM;
> +		return PTR_ERR(hace_dev->regs);
>  	}
> 
>  	/* Get irq number and register it */
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe()
  2022-08-30  3:13 [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe() Sun Ke
  2022-08-30  4:01 ` Neal Liu
@ 2022-09-09  9:07 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2022-09-09  9:07 UTC (permalink / raw)
  To: Sun Ke
  Cc: neal_liu, davem, joel, linux-aspeed, linux-crypto,
	linux-arm-kernel, kernel-janitors

On Tue, Aug 30, 2022 at 11:13:47AM +0800, Sun Ke wrote:
> In case of error, the function devm_ioremap_resource() returns
> ERR_PTR() not NULL. The NULL test in the return value check must be
> replaced with IS_ERR().
> 
> Fixes: 108713a713c7 ("crypto: aspeed - Add HACE hash driver")
> Signed-off-by: Sun Ke <sunke32@huawei.com>
> ---
>  drivers/crypto/aspeed/aspeed-hace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-09  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30  3:13 [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe() Sun Ke
2022-08-30  4:01 ` Neal Liu
2022-09-09  9:07 ` Herbert Xu

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).