From nobody Fri Dec 19 17:17:41 2025 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 B8C2932C936 for ; Thu, 6 Nov 2025 12:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762433601; cv=none; b=tZFeADmXYI4aw/VU88hdQE3ceH1NyRiqXL7RvLBtE/t2lSUXBbMDdIDgla0ACnxJOkdXGPwmURd57kpdsMD848p+0xzynh9cVm84exf3hcnAyzkcEW4pVJTvtXQdyyN+/5GrpzlzhPZScyu+hpGKAwSiKk7gO63jG94h02eVW00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762433601; c=relaxed/simple; bh=7iYJ58BtlFxh5N4iUZr364GIyx6CI8EugINx7k/GPGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sA5otsbceNRxo7PU8wcxJEyVrf2JfQj85ttfjpc1Lr6YK152y0s/f8zBTWYTZH0K1TmgjSz8JPryGUDx6RetGCYTXUAzvNgLDYLmzkZS3LRXtdHUTij8SCW1bfySlobAKVgRCOrJc/rD3V1h8E5McRlnkRWBADArALHXFSjKjmg= 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=KfTiNcb2; arc=none smtp.client-ip=185.246.85.4 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="KfTiNcb2" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id E3E844E4156D; Thu, 6 Nov 2025 12:53:17 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B90046068C; Thu, 6 Nov 2025 12:53:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B57F011851026; Thu, 6 Nov 2025 13:53:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762433597; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=1kW23ym1qnGitde+ICvZliYafoUJFTsz+cQqqnstk2I=; b=KfTiNcb2SktS5gXFxeLxKb2KcDHFrbuTj/xhx2G47u3EY0Js6ZdMP/cVC7nHOWHyLxyoCU uIWVCJ5f8DCfd6D3jZor15lECxcarAOFsgQ19lF5fp+r3Yjp9gNGcaH/6TqflWn20w/6VV x0+6/DLsFCQHMkRR1as/ayxbcXCFoIlssAWqnH1gk4aHM7r2KP843m1gF0d4avyWQS/9GF nAd3Ph8dZKSXsI7/gmLtoqM9fLgO8378VAPoXunRGGDvtgNdXx9z2l9SbAc4vW9+dFahJr UKuzTDrc/+ChxqLkm+Thr42JGlrP9FG2G2sMHpmn1IW/Yuw++1FhLOTmLQm4og== From: "Bastien Curutchet (Schneider Electric)" Date: Thu, 06 Nov 2025 13:53:08 +0100 Subject: [PATCH net v2 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: <20251106-ksz-fix-v2-1-07188f608873@bootlin.com> References: <20251106-ksz-fix-v2-0-07188f608873@bootlin.com> In-Reply-To: <20251106-ksz-fix-v2-0-07188f608873@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: ff319a644829 ("net: dsa: microchip: move interrupt handling logic fr= om lan937x to ksz_common") Signed-off-by: Bastien Curutchet (Schneider Electric) --- 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.0