From nobody Mon Feb 9 04:14:02 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A83D62BE632 for ; Fri, 14 Nov 2025 07:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763104839; cv=none; b=Y3BBaMwCi5MJLdH9pvNBsjQHZSY/IKmo2fKztT4TMH+g5m3JIwP89GOj6on7L599W67Dbp+CJUnNbu27wl9Yw+VwaV5Q+KXWkp/jIncuBRLnOyJ00wSwY93N2mi1c7/KrdTS3NgK872XZHaFoxD39R24l93YuVzeGaLDpAapqhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763104839; c=relaxed/simple; bh=bA81shltpQIqo6ERwe+YEEDiuPrqc/y6ChY0B4cSbI8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tPuomU405HiIeFa1m5nLIgB+ux7fEpAaKpnr7/iirPjM8BQF014vbPpBcKovPAtP2GknQ8edc6/gf4k44izqtjXBuVml38C8GXRJoLfh2ahrrrHpTdqcKAGtbE5DR1CnmmIzWkDnYwiKey/5B1RDJwwMgB/HBlTIJE2lyCPNE5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=fEVKbwMf; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="fEVKbwMf" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 10D5DC10F5B; Fri, 14 Nov 2025 07:20:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id CE2E56060E; Fri, 14 Nov 2025 07:20:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B198A102F27C7; Fri, 14 Nov 2025 08:20:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1763104828; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=JWi0y84NUpIkh/iErh4hngLnIokL0fky07nZkrhPRJc=; b=fEVKbwMfVc7aKOdKe4z+6mtD+AyLbUv/ysVYDkAkX0X5qo1FvJGhq+oHAwYJ84shynfYCT ZHn0Phc3qn/rI7gyQwKtN4AxuOWjZIBFMlA3ZyWowXIjuC0EptssI0OwzPaLQ9ucuphKs2 e2MNUrE7hn3pgeZcwb5eeQZIBQA+tYfoELq2uhsE6h6cHvW2EKlA8cdm12iAXDrN/5Koe+ qYtckMU7Z6Uo9LwKY7Rc8iPTuJqTh3Mm0DX66Xk649qvg4TgyxkgwOfuOgYpADvt0+uJFM eZKWYYrpJoiRwUGAImB4Vsbmc2OpjXIZdD81Ps/odSoMJP14bTC1WKx1Cp0bhA== From: "Bastien Curutchet (Schneider Electric)" Date: Fri, 14 Nov 2025 08:20:20 +0100 Subject: [PATCH net v3 1/4] net: dsa: microchip: common: Fix checks on irq_find_mapping() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251114-ksz-fix-v3-1-acbb3b9cc32f@bootlin.com> References: <20251114-ksz-fix-v3-0-acbb3b9cc32f@bootlin.com> In-Reply-To: <20251114-ksz-fix-v3-0-acbb3b9cc32f@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Arun Ramadoss Cc: Pascal Eberhard , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (Schneider Electric)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 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. Fixes: c9cd961c0d43 ("net: dsa: microchip: lan937x: add interrupt support f= or port phy link") Signed-off-by: Bastien Curutchet (Schneider Electric) Reviewed-by: Andrew Lunn --- drivers/net/dsa/microchip/ksz_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/micro= chip/ksz_common.c index a962055bfdbd8fbfc135b2dec73c222a213985c4..3a4516d32aa5f99109853ed400e= 64f8f7e2d8016 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2583,8 +2583,8 @@ static int ksz_irq_phy_setup(struct ksz_device *dev) =20 irq =3D irq_find_mapping(dev->ports[port].pirq.domain, PORT_SRC_PHY_INT); - if (irq < 0) { - ret =3D irq; + if (!irq) { + ret =3D -EINVAL; goto out; } ds->user_mii_bus->irq[phy] =3D irq; @@ -2948,8 +2948,8 @@ static int ksz_pirq_setup(struct ksz_device *dev, u8 = p) snprintf(pirq->name, sizeof(pirq->name), "port_irq-%d", p); =20 pirq->irq_num =3D irq_find_mapping(dev->girq.domain, p); - if (pirq->irq_num < 0) - return pirq->irq_num; + if (!pirq->irq_num) + return -EINVAL; =20 return ksz_irq_common_setup(dev, pirq); } --=20 2.51.1