]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ethernet: ezchip: fix error handling
authorPavel Skripkin <paskripkin@gmail.com>
Fri, 18 Jun 2021 16:14:47 +0000 (19:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:59:57 +0000 (16:59 +0200)
commit511b582a01974709f4b46fed44721d9bc010fa45
tree9074d02b3fc91a2ea78ef83f3addcd20d2ed829f
parentee930d2fd780768654d075088b087d87461dcd3b
net: ethernet: ezchip: fix error handling

[ Upstream commit 0de449d599594f5472e00267d651615c7f2c6c1d ]

As documented at drivers/base/platform.c for platform_get_irq:

 * Gets an IRQ for a platform device and prints an error message if finding the
 * IRQ fails. Device drivers should check the return value for errors so as to
 * not pass a negative integer value to the request_irq() APIs.

So, the driver should check that platform_get_irq() return value
is _negative_, not that it's equal to zero, because -ENXIO (return
value from request_irq() if irq was not found) will
pass this check and it leads to passing negative irq to request_irq()

Fixes: 0dd077093636 ("NET: Add ezchip ethernet driver")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/ezchip/nps_enet.c