]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ibm: emac: fix unchecked platform_get_irq return value
authorRosen Penev <rosenp@gmail.com>
Mon, 1 Jun 2026 04:02:00 +0000 (21:02 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Jun 2026 02:12:12 +0000 (19:12 -0700)
platform_get_irq() returns a negative errno on failure.
Commit a598f66d9169 replaced irq_of_parse_and_map() (which returns 0
on failure) with platform_get_irq() but dropped the error check.
Without it, a negative IRQ number is passed to devm_request_irq(),
which fails with -EINVAL instead of propagating the real error
from platform_get_irq().

Add the missing error check and goto err_gone.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260601040201.103481-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/emac/core.c

index e597e2ad434cccb71f25e973855aceceb92e0189..d2194b406c9e11c88e0462b384af74e964bd6750 100644 (file)
@@ -3035,6 +3035,11 @@ static int emac_probe(struct platform_device *ofdev)
 
        /* Setup error IRQ handler */
        dev->emac_irq = platform_get_irq(ofdev, 0);
+       if (dev->emac_irq < 0) {
+               err = dev->emac_irq;
+               goto err_gone;
+       }
+
        err = devm_request_irq(&ofdev->dev, dev->emac_irq, emac_irq, 0, "EMAC",
                               dev);
        if (err) {