2022-08-30 03:06:47

by Sun Ke

[permalink] [raw]
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 <[email protected]>
---
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


2022-08-30 04:24:20

by Neal Liu

[permalink] [raw]
Subject: RE: [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe()

> -----Original Message-----
> From: Sun Ke <[email protected]>
> Sent: Tuesday, August 30, 2022 11:14 AM
> To: Neal Liu <[email protected]>; [email protected];
> [email protected]; [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]
> 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 <[email protected]>

Thanks for the fix.
Reviewed-by: Neal Liu<[email protected]>

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

2022-09-09 09:09:03

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: aspeed: fix return value check in aspeed_hace_probe()

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 <[email protected]>
> ---
> drivers/crypto/aspeed/aspeed-hace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

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