realtek: Improve IRQ request in Ethernet driver
authorBirger Koblitz <git@birger-koblitz.de>
Tue, 11 Jan 2022 13:23:23 +0000 (14:23 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 17 Feb 2022 15:21:47 +0000 (15:21 +0000)
Improves the IRQ request code by using platform_get_irq() which provides
better error handling.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c

index 6db2b2a1fe7340479cb4fc5a187b355077077ba4..84b8a5b9435707a8c6ecc43348601e48e1939c68 100644 (file)
@@ -2209,14 +2209,13 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
 
        spin_lock_init(&priv->lock);
 
-       /* obtain device IRQ number */
-       res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (!res) {
+       /* Obtain device IRQ number */
+       dev->irq = platform_get_irq(pdev, 0);
+       if (dev->irq < 0) {
                dev_err(&pdev->dev, "cannot obtain IRQ, using default 24\n");
                dev->irq = 24;
-       } else {
-               dev->irq = res->start;
        }
+
        dev->ethtool_ops = &rtl838x_ethtool_ops;
        dev->min_mtu = ETH_ZLEN;
        dev->max_mtu = 1536;