netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Berger <opendmb@gmail.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>,
	wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com,
	f.fainelli@gmail.com, davem@davemloft.net
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/7 v2] net: bcmgenet: Fix platform_get_irq's error checking
Date: Mon, 4 Dec 2017 17:01:57 -0800	[thread overview]
Message-ID: <7fd6f043-3e66-a03a-e2fa-c71cffe5019e@gmail.com> (raw)
In-Reply-To: <1512409703-20881-2-git-send-email-arvind.yadav.cs@gmail.com>

On 12/04/2017 09:48 AM, Arvind Yadav wrote:
> The platform_get_irq() function returns negative number if an error occurs,
> Zero if No irq is found and positive number if irq gets successful.
> platform_get_irq() error checking only for zero is not correct.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> changes in v2:
>              commit message was not correct.
> 
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 24b4f4c..e2f1268 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3371,7 +3371,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
>  	priv->irq0 = platform_get_irq(pdev, 0);
>  	priv->irq1 = platform_get_irq(pdev, 1);
>  	priv->wol_irq = platform_get_irq(pdev, 2);
> -	if (!priv->irq0 || !priv->irq1) {
> +	if (priv->irq0 <= 0 || priv->irq1 <= 0 || priv->wol_irq <= 0) {
>  		dev_err(&pdev->dev, "can't find IRQs\n");
>  		err = -EINVAL;
>  		goto err;
> 

The absence of a Wake-on-LAN interrupt (wol_irq <= 0) is not a terminal
error for the driver so it should not be included in this check.

The error checking for irq0 and irq1 is appropriate to add, but it
sounds like David Miller is proposing changing platform_get_irq() so
I'll let that dust settle before saying whether <= or < is appropriate.

Thanks,
    Doug

  reply	other threads:[~2017-12-05  1:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 17:48 [PATCH 0/7 v2] net: Fix platform_get_irq's error checking Arvind Yadav
2017-12-04 17:48 ` [PATCH 1/7 v2] net: bcmgenet: " Arvind Yadav
2017-12-05  1:01   ` Doug Berger [this message]
2017-12-04 17:48 ` [PATCH 2/7 v2] net: ezchip: nps_enet: " Arvind Yadav
2017-12-04 17:48 ` [PATCH 3/7 v2] can: xilinx: " Arvind Yadav
2017-12-04 17:48 ` [PATCH 4/7 v2] net: ethernet: i825xx: " Arvind Yadav
2017-12-04 18:25   ` David Miller
2017-12-05  5:34     ` Arvind Yadav
2017-12-05 15:49       ` David Miller
2017-12-06 12:19         ` Sergei Shtylyov
2017-12-08  9:38           ` arvindY
2017-12-05 10:12     ` Sergei Shtylyov
2017-12-05 10:58       ` Russell King - ARM Linux
2017-12-04 17:48 ` [PATCH 5/7 v2] net: ethernet: natsemi: " Arvind Yadav
2017-12-04 17:48 ` [PATCH 6/7 v2] net: ethernet: smsc: " Arvind Yadav
2017-12-04 17:48 ` [PATCH 7/7 v2] net: fjes: " Arvind Yadav
2017-12-05  9:54 ` [PATCH 0/7 v2] net: " Sergei Shtylyov
2017-12-05  9:57   ` Sergei Shtylyov
2017-12-05 10:02     ` Arvind Yadav

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=7fd6f043-3e66-a03a-e2fa-c71cffe5019e@gmail.com \
    --to=opendmb@gmail.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).