crypto: aspeed - Fix check for platform_get_irq() errors
authorYueHaibing <yuehaibing@huawei.com>
Tue, 20 Sep 2022 03:21:18 +0000 (11:21 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Sep 2022 05:57:50 +0000 (13:57 +0800)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/aspeed/aspeed-hace.c

index 3f880aafb6a278afad8ebf14e5e05c71e0875048..f7f1d33defb11dc7b03a1d20379bf97da838b75f 100644 (file)
@@ -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);