mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
net: dsa: microchip: common: Fix checks on irq_find_mapping()
irq_find_mapping() returns a positive IRQ number or 0 if no IRQ is found
but it never returns a negative value. However, on each
irq_find_mapping() call, we verify that the returned value isn't
negative.
Fix the irq_find_mapping() checks to enter error paths when 0 is
returned. Return -EINVAL in such cases.
CC: stable@vger.kernel.org
Fixes: c9cd961c0d ("net: dsa: microchip: lan937x: add interrupt support for port phy link")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20251120-ksz-fix-v6-1-891f80ae7f8f@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
7526183cfd
commit
7b3c09e166
@@ -2587,8 +2587,8 @@ static int ksz_irq_phy_setup(struct ksz_device *dev)
|
||||
|
||||
irq = irq_find_mapping(dev->ports[port].pirq.domain,
|
||||
PORT_SRC_PHY_INT);
|
||||
if (irq < 0) {
|
||||
ret = irq;
|
||||
if (!irq) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
ds->user_mii_bus->irq[phy] = irq;
|
||||
@@ -2952,8 +2952,8 @@ static int ksz_pirq_setup(struct ksz_device *dev, u8 p)
|
||||
snprintf(pirq->name, sizeof(pirq->name), "port_irq-%d", p);
|
||||
|
||||
pirq->irq_num = irq_find_mapping(dev->girq.domain, p);
|
||||
if (pirq->irq_num < 0)
|
||||
return pirq->irq_num;
|
||||
if (!pirq->irq_num)
|
||||
return -EINVAL;
|
||||
|
||||
return ksz_irq_common_setup(dev, pirq);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user