net: hisilicon: fix the return value handle and remove redundant netdev_err() for...
authorRuan Jinjie <ruanjinjie@huawei.com>
Mon, 31 Jul 2023 07:38:58 +0000 (15:38 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Aug 2023 19:06:23 +0000 (12:06 -0700)
There is no possible for platform_get_irq() to return 0
and the return value of platform_get_irq() is more sensible
to show the error reason.

And there is no need to call the netdev_err() function directly to print
a custom message when handling an error from platform_get_irq() function as
it is going to display an appropriate error message in case of a failure.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20230731073858.3633193-1-ruanjinjie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hip04_eth.c
drivers/net/ethernet/hisilicon/hisi_femac.c
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c

index 50c3f5d6611f055031804f17a9bfa2cc9fde7247..ecf92a5d56bbf2ab049d35e957b239fe8e74cdbb 100644 (file)
@@ -960,8 +960,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
        }
 
        irq = platform_get_irq(pdev, 0);
-       if (irq <= 0) {
-               ret = -EINVAL;
+       if (irq < 0) {
+               ret = irq;
                goto init_fail;
        }
 
index ce2571c16e431eb181157f216651dee896d4c8da..cb7b0293fe85c9f1eafc24f5958a353ba6c69a6a 100644 (file)
@@ -862,8 +862,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
                goto out_disconnect_phy;
 
        ndev->irq = platform_get_irq(pdev, 0);
-       if (ndev->irq <= 0) {
-               ret = -ENODEV;
+       if (ndev->irq < 0) {
+               ret = ndev->irq;
                goto out_disconnect_phy;
        }
 
index f867e95311173f2340eeda9f2c2f5020c8531fd0..26d22bb04b8790966a6a97e9c9a0c654921d1e03 100644 (file)
@@ -1206,9 +1206,8 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
        }
 
        ndev->irq = platform_get_irq(pdev, 0);
-       if (ndev->irq <= 0) {
-               netdev_err(ndev, "No irq resource\n");
-               ret = -EINVAL;
+       if (ndev->irq < 0) {
+               ret = ndev->irq;
                goto out_phy_node;
        }