staging: fieldbus: arcx-anybus: Do not check 0 for platform_get_irq()
authorZhu Wang <wangzhu9@huawei.com>
Thu, 3 Aug 2023 09:27:01 +0000 (17:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Aug 2023 14:19:55 +0000 (16:19 +0200)
Since platform_get_irq() never returned zero, so it need not to check
whether it returned zero, and we use the return error code of
platform_get_irq() to replace the current return error code, for that
platform_get_irq() may return -EINVAL or -ENXIO.

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
Link: https://lore.kernel.org/r/20230803092701.52697-1-wangzhu9@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fieldbus/anybuss/arcx-anybus.c

index f135b9f..be28165 100644 (file)
@@ -156,8 +156,8 @@ create_anybus_host(struct platform_device *pdev, int idx)
        if (IS_ERR(ops.regmap))
                return ERR_CAST(ops.regmap);
        ops.irq = platform_get_irq(pdev, idx);
-       if (ops.irq <= 0)
-               return ERR_PTR(-EINVAL);
+       if (ops.irq < 0)
+               return ERR_PTR(ops.irq);
        return devm_anybuss_host_common_probe(&pdev->dev, &ops);
 }