From nobody Fri Dec 19 17:17:39 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 24A5832C956 for ; Thu, 6 Nov 2025 12:53:20 +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=1762433603; cv=none; b=buutqxVB28q3Wnu46CB1Mn/cxR+tcyoa2GC3vyGIYJm1C0BAufPIExD4OVc8O5vyquHro3O6RJErOiTgb03D3fzuL5uLUn4fsUlob3QdHcjyhJ3Pf/Df/CNKxOu4On27TMu3gzY+f6z5tmZZh5/ZvDvSTwRbLrwUQpKOcuWGTdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762433603; c=relaxed/simple; bh=DgaEBzJVE0diUpcGF2jdqQ0yAib13/RGrDpfzFmIiKQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V9qZzQ02v9cjRVxPm7nZFNMu1/FrlO5p9z0wak8fZcX325fhG4giEw3yvkWPhPCvwaGL+/jn8enwbZSooHVg9oMgGQVbbkK54rinHKzP8jWTC9kdy1mvkEBZ/lmwJnrHQjyNp5h9SPL9+nRk8FLAIP0Dfn88L4IkOK2lLJuIky4= 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=g3EOW+eG; 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="g3EOW+eG" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5602C4E41460; Thu, 6 Nov 2025 12:53:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2B4CB6068C; Thu, 6 Nov 2025 12:53:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4CED71185102A; Thu, 6 Nov 2025 13:53:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762433598; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=U52A0foBkCvgyCUwDdVQ7zTmGiYooyVZixhAGJ0JZp4=; b=g3EOW+eGxuVNT5I+V9nxHKZM18Y6DjUN+oYkr6K8uOh0+Z5Rng0mL9EF/XsCp3l0I4El5Z RvoQOXMJ/w7MKzF3mkM3EGSlvcRbULcte5qOoyAzckRtS5hgQ43f4QMtxnnZaxGvukc7PZ 5HdWDsprEhGYHT5dja3XpvBzXtsTdzI9zi6PPfSSpte81N4lXW8XNBE2KpoNStGU6GnfF1 IQ3XYO6Xh5vATkXfiqEQEFUksRAI/rzX4MLVG/CX1wcwfaUDv5/vPPvbyhvkmgA5d7oGG/ FYUnzoyFn6oXilNo/lrzmIMR/lmQ/Hr6M35hI+dM5WURyht8M+NMzffiZq9oAg== From: "Bastien Curutchet (Schneider Electric)" Date: Thu, 06 Nov 2025 13:53:09 +0100 Subject: [PATCH net v2 2/4] 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: <20251106-ksz-fix-v2-2-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, 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. Fixes: cc13ab18b201 ("net: dsa: microchip: ptp: enable interrupt for timest= amping") 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.0