diff mbox series

[RFC,V2,2/6] net: bcmgenet: Avoid touching non-existent interrupt

Message ID 1572702093-18261-3-git-send-email-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series ARM: Enable GENET support for RPi 4 | expand

Commit Message

Stefan Wahren Nov. 2, 2019, 1:41 p.m. UTC
As platform_get_irq() now prints an error when the interrupt does not
exist, we are getting a confusing error message in case the optional
WOL IRQ is not defined:

  bcmgenet fd58000.ethernet: IRQ index 2 not found

Fix this by using the platform_irq_count() helper to avoid touching a
non-existent interrupt.

Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.7.4

Comments

Florian Fainelli Nov. 2, 2019, 7:34 p.m. UTC | #1
On 11/2/2019 6:41 AM, Stefan Wahren wrote:
> As platform_get_irq() now prints an error when the interrupt does not
> exist, we are getting a confusing error message in case the optional
> WOL IRQ is not defined:
> 
>   bcmgenet fd58000.ethernet: IRQ index 2 not found
> 
> Fix this by using the platform_irq_count() helper to avoid touching a
> non-existent interrupt.
> 
> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 105b3be..ac554a6 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3473,7 +3473,8 @@ static int bcmgenet_probe(struct platform_device *pdev)
>  		err = priv->irq1;
>  		goto err;
>  	}
> -	priv->wol_irq = platform_get_irq(pdev, 2);
> +	if (platform_irq_count(pdev) > 2)
> +		priv->wol_irq = platform_get_irq(pdev, 2);

Or you could use platform_get_irq_optional() for the WoL IRQ line?
Stefan Wahren Nov. 3, 2019, 9:36 a.m. UTC | #2
Am 02.11.19 um 20:34 schrieb Florian Fainelli:
> On 11/2/2019 6:41 AM, Stefan Wahren wrote:
>> As platform_get_irq() now prints an error when the interrupt does not
>> exist, we are getting a confusing error message in case the optional
>> WOL IRQ is not defined:
>>
>>   bcmgenet fd58000.ethernet: IRQ index 2 not found
>>
>> Fix this by using the platform_irq_count() helper to avoid touching a
>> non-existent interrupt.
>>
>> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> ---
>>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>> index 105b3be..ac554a6 100644
>> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>> @@ -3473,7 +3473,8 @@ static int bcmgenet_probe(struct platform_device *pdev)
>>  		err = priv->irq1;
>>  		goto err;
>>  	}
>> -	priv->wol_irq = platform_get_irq(pdev, 2);
>> +	if (platform_irq_count(pdev) > 2)
>> +		priv->wol_irq = platform_get_irq(pdev, 2);
> Or you could use platform_get_irq_optional() for the WoL IRQ line?
Yes, this would be better.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 105b3be..ac554a6 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3473,7 +3473,8 @@  static int bcmgenet_probe(struct platform_device *pdev)
 		err = priv->irq1;
 		goto err;
 	}
-	priv->wol_irq = platform_get_irq(pdev, 2);
+	if (platform_irq_count(pdev) > 2)
+		priv->wol_irq = platform_get_irq(pdev, 2);

 	if (dn)
 		macaddr = of_get_mac_address(dn);