From nobody Tue Dec 2 02:43:38 2025 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 5363D3730E1 for ; Tue, 18 Nov 2025 16:13:33 +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=1763482415; cv=none; b=ON/5GwwoK6qYYtQaLSBIN2UTpqP5SsMXzzLwjDmNDOOtyAVZg9A6lh8vKuZjl8y1K7XX2jCLun6DvDUddP7YaSLkG+kRJfPx6TBOoAcKO/24d5/j0k+DiP1u7czdEYbTw+C9kwa0WWIjQ+WP6D2nqHYyvfPOE9JajV6y3lbPCt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763482415; c=relaxed/simple; bh=AEmkrFjqifoQnRxMtvLlTc3t/RLufAY+GpBg7zW6NZI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jitu0M1yarHo8N5rAW41tJgPTy0VNn7a5g2A8jEtuL++UMEkDUybQDpg/jPT26U0a8QhfLbrSRgTZj4hmTfgI1SbkL3J4qOFTqOQ1+8EFoWXxbzTRuqv/bDqWGi/tM3B/VZaRNxEAp40OT2ozurOWTvR2NW+ug2svCXFaZYmJBM= 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=B42aIL7x; 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="B42aIL7x" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id C7972C10F57; Tue, 18 Nov 2025 16:13:09 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id EE6A6606FE; Tue, 18 Nov 2025 16:13:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id F263C10371605; Tue, 18 Nov 2025 17:13:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1763482411; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PtjJwnZbSztJ0ylhjAx5WuFm6ywuzKa2m4FJNifI2/U=; b=B42aIL7xyojyioHuEIQM7P9blZcRUYLY3tIFmwjtpLaCFqOjHY2E2B5u5+fYcfstjgXJhZ OqXsQ1yZSugH9rPiIlydOj3uRMu3h/LO/2BuhEig/2P0V7C+rPDg9vdJbZhAeFZW850gO9 3AVJHiY6TTS+pUhREA6QK2mP840gmrDl8YkCfKS1seePHRYATunlM4THyAx57V+VzayXli tbFnKxo2WZGQCMT9BaQI9taCVW6iSPZp+UnFdGAqlWhOUsR58gE+jhK1N8DtlV+gENeI76 AnifmqtHAuSxPvVA34MWTLAF1AHVmtsOFHcdkN37F1Fp2AlRjk+9+mQtQ3sQ/g== From: "Bastien Curutchet (Schneider Electric)" Date: Tue, 18 Nov 2025 17:13:23 +0100 Subject: [PATCH net v5 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: <20251118-ksz-fix-v5-2-8e9c7f56618d@bootlin.com> References: <20251118-ksz-fix-v5-0-8e9c7f56618d@bootlin.com> In-Reply-To: <20251118-ksz-fix-v5-0-8e9c7f56618d@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