mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Rosen Penev <rosenp@gmail.com>, <netdev@vger.kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: ibm: emac: mal: fix unchecked platform_get_irq return values
Date: Wed, 3 Jun 2026 14:30:44 -0700	[thread overview]
Message-ID: <f5354617-25fd-46e5-b795-c5aedd011c88@intel.com> (raw)
In-Reply-To: <20260601040252.103585-1-rosenp@gmail.com>

On 5/31/2026 9:02 PM, Rosen Penev wrote:
> 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.
> 
> Fixes: c4f5d0454cab5 ("net: ibm: emac: mal: move irq maps down")
> Assisted-by: Opencode:Big-Pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  drivers/net/ethernet/ibm/emac/mal.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
> index 7d70056e9008..63a7a32aaf72 100644
> --- a/drivers/net/ethernet/ibm/emac/mal.c
> +++ b/drivers/net/ethernet/ibm/emac/mal.c
> @@ -635,6 +635,12 @@ 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;
> +		dev_err_probe(&ofdev->dev, err, "failed to get IRQ\n");
> +		goto fail2;
> +	}
>  
>  	if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) {
>  		mal->txde_irq = mal->rxde_irq = mal->serr_irq;
> @@ -643,6 +649,11 @@ 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;
> +			dev_err_probe(&ofdev->dev, err, "failed to get IRQ\n");
> +			goto fail2;
> +		}
>  		irqflags = 0;
>  		hdlr_serr = mal_serr;
>  		hdlr_txde = mal_txde;


      reply	other threads:[~2026-06-03 21:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  4:02 Rosen Penev
2026-06-03 21:30 ` Jacob Keller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5354617-25fd-46e5-b795-c5aedd011c88@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rosenp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®