diff mbox series

[-next] crypto: aspeed - Fix check for platform_get_irq() errors

Message ID 20220920032118.6440-1-yuehaibing@huawei.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [-next] crypto: aspeed - Fix check for platform_get_irq() errors | expand

Commit Message

Yue Haibing Sept. 20, 2022, 3:21 a.m. UTC
The platform_get_irq() function returns negative on error and
positive non-zero values on success. It never returns zero, but if it
did then treat that as a success.

Also remove redundant dev_err() print as platform_get_irq() already
prints an error.

Fixes: 108713a713c7 ("crypto: aspeed - Add HACE hash driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/crypto/aspeed/aspeed-hace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Neal Liu Sept. 20, 2022, 5:24 a.m. UTC | #1
> The platform_get_irq() function returns negative on error and positive non-zero
> values on success. It never returns zero, but if it did then treat that as a
> success.
> 
> Also remove redundant dev_err() print as platform_get_irq() already prints an
> error.
> 
> Fixes: 108713a713c7 ("crypto: aspeed - Add HACE hash driver")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Reviewed-by: Neal Liu <neal_liu@aspeedtech.com>

> ---
>  drivers/crypto/aspeed/aspeed-hace.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/aspeed/aspeed-hace.c
> b/drivers/crypto/aspeed/aspeed-hace.c
> index 3f880aafb6a2..f7f1d33defb1 100644
> --- a/drivers/crypto/aspeed/aspeed-hace.c
> +++ b/drivers/crypto/aspeed/aspeed-hace.c
> @@ -130,10 +130,8 @@ static int aspeed_hace_probe(struct platform_device
> *pdev)
> 
>  	/* Get irq number and register it */
>  	hace_dev->irq = platform_get_irq(pdev, 0);
> -	if (!hace_dev->irq) {
> -		dev_err(&pdev->dev, "Failed to get interrupt\n");
> +	if (hace_dev->irq < 0)
>  		return -ENXIO;
> -	}
> 
>  	rc = devm_request_irq(&pdev->dev, hace_dev->irq, aspeed_hace_irq, 0,
>  			      dev_name(&pdev->dev), hace_dev);
> --
> 2.17.1
Herbert Xu Sept. 30, 2022, 6:15 a.m. UTC | #2
On Tue, Sep 20, 2022 at 11:21:18AM +0800, YueHaibing wrote:
> The platform_get_irq() function returns negative on error and
> positive non-zero values on success. It never returns zero, but if it
> did then treat that as a success.
> 
> Also remove redundant dev_err() print as platform_get_irq() already
> prints an error.
> 
> Fixes: 108713a713c7 ("crypto: aspeed - Add HACE hash driver")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/crypto/aspeed/aspeed-hace.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/aspeed/aspeed-hace.c b/drivers/crypto/aspeed/aspeed-hace.c
index 3f880aafb6a2..f7f1d33defb1 100644
--- a/drivers/crypto/aspeed/aspeed-hace.c
+++ b/drivers/crypto/aspeed/aspeed-hace.c
@@ -130,10 +130,8 @@  static int aspeed_hace_probe(struct platform_device *pdev)
 
 	/* Get irq number and register it */
 	hace_dev->irq = platform_get_irq(pdev, 0);
-	if (!hace_dev->irq) {
-		dev_err(&pdev->dev, "Failed to get interrupt\n");
+	if (hace_dev->irq < 0)
 		return -ENXIO;
-	}
 
 	rc = devm_request_irq(&pdev->dev, hace_dev->irq, aspeed_hace_irq, 0,
 			      dev_name(&pdev->dev), hace_dev);