]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ibm: emac: mal: fix unchecked platform_get_irq return values
authorRosen Penev <rosenp@gmail.com>
Wed, 3 Jun 2026 21:17:34 +0000 (14:17 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Jun 2026 00:23:24 +0000 (17:23 -0700)
platform_get_irq() returns a negative errno on failure.
Commit c4f5d0454cab5 moved the platform_get_irq() calls and explicitly
removed the error checks that were previously present, claiming
devm_request_irq() can handle it. However, a negative IRQ number
passed to devm_request_irq() fails with -EINVAL instead of
propagating the real error from platform_get_irq().

Restore the missing error checks with proper errno propagation.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260603211734.30750-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/emac/mal.c

index 7d70056e90081cbd1af42bb9921b1f38c6583016..83dd7f99d8d524100315b4e27a769881078566f2 100644 (file)
@@ -635,6 +635,11 @@ static int mal_probe(struct platform_device *ofdev)
        mal->txeob_irq = platform_get_irq(ofdev, 0);
        mal->rxeob_irq = platform_get_irq(ofdev, 1);
        mal->serr_irq = platform_get_irq(ofdev, 2);
+       if (mal->txeob_irq < 0 || mal->rxeob_irq < 0 || mal->serr_irq < 0) {
+               err = mal->txeob_irq < 0 ? mal->txeob_irq :
+                     mal->rxeob_irq < 0 ? mal->rxeob_irq : mal->serr_irq;
+               goto fail2;
+       }
 
        if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) {
                mal->txde_irq = mal->rxde_irq = mal->serr_irq;
@@ -643,6 +648,10 @@ static int mal_probe(struct platform_device *ofdev)
        } else {
                mal->txde_irq = platform_get_irq(ofdev, 3);
                mal->rxde_irq = platform_get_irq(ofdev, 4);
+               if (mal->txde_irq < 0 || mal->rxde_irq < 0) {
+                       err = mal->txde_irq < 0 ? mal->txde_irq : mal->rxde_irq;
+                       goto fail2;
+               }
                irqflags = 0;
                hdlr_serr = mal_serr;
                hdlr_txde = mal_txde;