diff mbox

net: lpc_eth: remove irq > NR_IRQS check from probe()

Message ID 1449036733-20632-1-git-send-email-vz@mleia.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Vladimir Zapolskiy Dec. 2, 2015, 6:12 a.m. UTC
If the driver is used on an ARM platform with SPARSE_IRQ defined,
semantics of NR_IRQS is different (minimal value of virtual irqs) and
by default it is set to 16, see arch/arm/include/asm/irq.h.

This value may be less than the actual number of virtual irqs, which
may break the driver initialization. The check removal allows to use
the driver on such a platform, and, if irq controller driver works
correctly, the check is not needed on legacy platforms.

Fixes a runtime problem:

    lpc-eth 31060000.ethernet: error getting resources.
    lpc_eth: lpc-eth: not found (-6).

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/net/ethernet/nxp/lpc_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Dec. 3, 2015, 8:02 p.m. UTC | #1
From: Vladimir Zapolskiy <vz@mleia.com>
Date: Wed,  2 Dec 2015 08:12:13 +0200

> If the driver is used on an ARM platform with SPARSE_IRQ defined,
> semantics of NR_IRQS is different (minimal value of virtual irqs) and
> by default it is set to 16, see arch/arm/include/asm/irq.h.
> 
> This value may be less than the actual number of virtual irqs, which
> may break the driver initialization. The check removal allows to use
> the driver on such a platform, and, if irq controller driver works
> correctly, the check is not needed on legacy platforms.
> 
> Fixes a runtime problem:
> 
>     lpc-eth 31060000.ethernet: error getting resources.
>     lpc_eth: lpc-eth: not found (-6).
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index b159ef8..0576651 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1326,7 +1326,7 @@  static int lpc_eth_drv_probe(struct platform_device *pdev)
 	/* Get platform resources */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if ((!res) || (irq < 0) || (irq >= NR_IRQS)) {
+	if (!res || irq < 0) {
 		dev_err(&pdev->dev, "error getting resources.\n");
 		ret = -ENXIO;
 		goto err_exit;