mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Justin Chen <justin.chen@broadcom.com>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
	f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com,
	bcm-kernel-feedback-list@broadcom.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: systemport: Add and correct check for platform_get_irq
Date: Wed, 31 May 2023 15:42:26 -0700	[thread overview]
Message-ID: <2bdc58c5-455c-8b1f-59f3-69e43dc1f8ee@broadcom.com> (raw)
In-Reply-To: <20230531091159.8933-1-jiasheng@iscas.ac.cn>

[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]



On 5/31/23 2:11 AM, Jiasheng Jiang wrote:
> Add the missing check for "priv->wol_irq".
> Use "<" instead of "<=" to check the irqs since the platform_get_irq
> returns non-zero IRQ number on success and negative error number on
> failure, shown in `driver/base/platform.c`.
> 
> Fixes: 83e82f4c706b ("net: systemport: add Wake-on-LAN support")
> Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>   drivers/net/ethernet/broadcom/bcmsysport.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 38d0cdaf22a5..16c9c0be1a33 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -2535,7 +2535,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
>   	} else {
>   		priv->wol_irq = platform_get_irq(pdev, 1);
>   	}
> -	if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) {
> +	if (priv->irq0 < 0 || (priv->irq1 < 0 && !priv->is_lite) || priv->wol_irq < 0) {
>   		ret = -EINVAL;
>   		goto err_free_netdev;
>   	}

wol_irq is optional so we don't want to error out. Guess we should 
probably replace platform_get_irq with platform_get_irq_optional(). "<=" 
is fine. As you mentioned, a non-zero is success, so zero is considered 
invalid.

Thanks,
Justin

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4206 bytes --]

  reply	other threads:[~2023-05-31 22:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  9:11 Jiasheng Jiang
2023-05-31 22:42 ` Justin Chen [this message]
2023-06-01  3:16 Jiasheng Jiang

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=2bdc58c5-455c-8b1f-59f3-69e43dc1f8ee@broadcom.com \
    --to=justin.chen@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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®