From nobody Tue Dec 2 02:19:52 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 DD0063126B1 for ; Thu, 20 Nov 2025 09:12:16 +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=1763629938; cv=none; b=oXDupoSxQOjGkcg0QAiL5VnKyxunsl37s+narzUulOPqmvczsO/IP37W8NX5wA0Iz2zEMcop1bFKWd+pmd15jxeD6sKlcjp1/3EMiWr0mpDg4uoYkJ3AFn83mihcig75wTmiSMxpZFF5LnkHLNG5TXHNflN+TR/isKXckmypMi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763629938; c=relaxed/simple; bh=AEmkrFjqifoQnRxMtvLlTc3t/RLufAY+GpBg7zW6NZI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C2GIV4joedDGStb47rc8eKN/wFF547rzlS+dpfbAIV3Xnr+2s65tWqnsZsOrkz8p6fiuNVJisvFsw95QRfHdCGaPqpUj40wSnE/IIQhcQwNT10d+rKALki47YNvABe8KtSvDEXKI1Yyx1IgjUs13FEH3brjGjrLmZewgdRquN5c= 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=DB6hxTh3; 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="DB6hxTh3" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4F2864E417E1; Thu, 20 Nov 2025 09:12:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 255576068C; Thu, 20 Nov 2025 09:12:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D2ECA10371C0B; Thu, 20 Nov 2025 10:12:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1763629934; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PtjJwnZbSztJ0ylhjAx5WuFm6ywuzKa2m4FJNifI2/U=; b=DB6hxTh3ch+YWeDlN8YahCmb1mUPG3v428civqRVeubz+jt45GH4H6C5M8vSWgUV0Jw9fH eUTm0D1IoOMEkOZKJpAqdE7swG2XoCsRLRmPh/3EN3ypUHi361m2JnV8r65wae7P0FbWnX E5B5/IiHDjBjJmiWZk3gmz9bTR+GC3NmkgvPriHra6nPzNBwph2UDTWCycPz/+TEP2cFzm jzh+nHILmIWly/bJhKX5p0/kudhQndzsCCWyS+weTdK+Oh3ofyUC/5MBM5Vzqk2LzjxoRR m4gRHx+4WJlbxR8mWSpqMRiohn6BgmhtCFeeanfVou9arsMYVT/7UBekA/mmyw== From: "Bastien Curutchet (Schneider Electric)" Date: Thu, 20 Nov 2025 10:12:01 +0100 Subject: [PATCH net v6 2/5] net: dsa: microchip: ptp: 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: <20251120-ksz-fix-v6-2-891f80ae7f8f@bootlin.com> References: <20251120-ksz-fix-v6-0-891f80ae7f8f@bootlin.com> In-Reply-To: <20251120-ksz-fix-v6-0-891f80ae7f8f@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)" , stable@vger.kernel.org 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, during the PTP IRQ setup, we verify that its returned value isn't negative. Fix the irq_find_mapping() check to enter the error path when 0 is returned. Return -EINVAL in such case. Cc: stable@vger.kernel.org Fixes: cc13ab18b201 ("net: dsa: microchip: ptp: enable interrupt for timest= amping") Reviewed-by: Andrew Lunn Signed-off-by: Bastien Curutchet (Schneider Electric) --- drivers/net/dsa/microchip/ksz_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchi= p/ksz_ptp.c index 35fc21b1ee48a47daa278573bfe8749c7b42c731..c8bfbe5e2157323ecf29149d190= 7b77e689aa221 100644 --- a/drivers/net/dsa/microchip/ksz_ptp.c +++ b/drivers/net/dsa/microchip/ksz_ptp.c @@ -1139,8 +1139,8 @@ int ksz_ptp_irq_setup(struct dsa_switch *ds, u8 p) irq_create_mapping(ptpirq->domain, irq); =20 ptpirq->irq_num =3D irq_find_mapping(port->pirq.domain, PORT_SRC_PTP_INT); - if (ptpirq->irq_num < 0) { - ret =3D ptpirq->irq_num; + if (!ptpirq->irq_num) { + ret =3D -EINVAL; goto out; } =20 --=20 2.51.1