Skip to content

Commit

Permalink
lib82596: Fix IRQ check in sni_82596_probe
Browse files Browse the repository at this point in the history
platform_get_irq() returns negative error number instead 0 on failure.
And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes: 1159788 ("i825xx: Move the Intel 82586/82593/82596 based drivers")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Miaoqian Lin authored and David S. Miller committed Jan 14, 2022
1 parent ea93824 commit 99218cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/i825xx/sni_82596.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ static int sni_82596_probe(struct platform_device *dev)
netdevice->dev_addr[5] = readb(eth_addr + 0x06);
iounmap(eth_addr);

if (!netdevice->irq) {
if (netdevice->irq < 0) {
printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n",
__FILE__, netdevice->base_addr);
retval = netdevice->irq;
goto probe_failed;
}

Expand Down

0 comments on commit 99218cb

Please sign in to comment.