From nobody Tue Feb 10 07:39:00 2026 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 B63632F693E; Fri, 31 Oct 2025 16:05:50 +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=1761926752; cv=none; b=sBZTTpOrQ9ZZMJXSKXrRu2LBEdJF/V4m5JsMyqcuEBQ/f8RpQYjbV6fwWu7rYoWmulRY0KT1Rv5xqDn7TGYs5qxiSvxoEIkKGzM/whYTRCj+2F1aAIf7QETC1jOf6KqnY9fqzgi7Qt3XITvTtZiJhiw8YFc/cnGGVOgWd+J+ACU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761926752; c=relaxed/simple; bh=95X8NfNg94Ut5ngq92r3DA5Bj+TwY3d3z4iHIBxI1SI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JBZjicEE6DJKEPL9kTJ+whqVA1azcGNSVFrG+9sZfxMmv9D4xM77Y63mtnrzm20nCAZanyAdZqXYSzJWIeZYNytAusTCqbfLeXkE2889tjepHoH6EFEanQ61yB0ZS4KgFw5+MWDyag1Nw5A/tcwpbdaL90g8ptzoFetceysJGQs= 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=r/Eg/NM9; 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="r/Eg/NM9" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id E8B3B4E41445; Fri, 31 Oct 2025 16:05:48 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BFB0260704; Fri, 31 Oct 2025 16:05:48 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0DFA511818067; Fri, 31 Oct 2025 17:05:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761926748; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=lo3kX3rnuQel+DCOioyxlIMM2H/4F/tW6UiRMe3mpSw=; b=r/Eg/NM9wAN7B/lEvAH/7SeK4ifGkCo9EPiCrT5CP0328hJO4vDoD+Uv5Mq4J2SCgzo+4g PGBPV05ydRhdkXovgas4BwohBayeChJ/7tHqdSqmpEuAR11hL4GYy56Cc9TKSE637j3UBA wfnJvUBI3gD71fMY6B9yBJo1HWiujRpqciGrECY0BhtuhEg6ojmLmXv8viAyALZuf8konV Nt2+8vtKOeKxuWXffAvkoVxkvuorxcOdcWecCo39nmcUR9MDucyiFCKntp5W9QB8uItvXr mNVVzlkfKlQlrLip+Fw5Mjg2UE39avqRr1qRuLYpoEFcY87mNAkt4MxqRlQ5PA== From: "Bastien Curutchet (Schneider Electric)" Date: Fri, 31 Oct 2025 17:05:40 +0100 Subject: [PATCH net 3/3] net: dsa: microchip: Immediately assing IRQ numbers 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: <20251031-ksz-fix-v1-3-7e46de999ed1@bootlin.com> References: <20251031-ksz-fix-v1-0-7e46de999ed1@bootlin.com> In-Reply-To: <20251031-ksz-fix-v1-0-7e46de999ed1@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran 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 The IRQ numbers created through irq_create_mapping() are only assigned to ptpmsg_irq[n].num at the end of the IRQ setup. So if an error occurs between their creation and their assignment (for instance during the request_threaded_irq() step), we enter the error path and try to release the not yet assigned ptpmsg_irq[n].num. Assing the IRQ number at mapping creation. Signed-off-by: Bastien Curutchet (Schneider Electric) --- drivers/net/dsa/microchip/ksz_ptp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchi= p/ksz_ptp.c index c8bfbe5e2157323ecf29149d1907b77e689aa221..a8ad99c6ee35ff60fb56cc57705= 20a793c86ff66 100644 --- a/drivers/net/dsa/microchip/ksz_ptp.c +++ b/drivers/net/dsa/microchip/ksz_ptp.c @@ -1102,10 +1102,6 @@ static int ksz_ptp_msg_irq_setup(struct ksz_port *po= rt, u8 n) =20 strscpy(ptpmsg_irq->name, name[n]); =20 - ptpmsg_irq->num =3D irq_find_mapping(port->ptpirq.domain, n); - if (ptpmsg_irq->num < 0) - return ptpmsg_irq->num; - return request_threaded_irq(ptpmsg_irq->num, NULL, ksz_ptp_msg_thread_fn, IRQF_ONESHOT, ptpmsg_irq->name, ptpmsg_irq); @@ -1135,8 +1131,13 @@ int ksz_ptp_irq_setup(struct dsa_switch *ds, u8 p) if (!ptpirq->domain) return -ENOMEM; =20 - for (irq =3D 0; irq < ptpirq->nirqs; irq++) - irq_create_mapping(ptpirq->domain, irq); + for (irq =3D 0; irq < ptpirq->nirqs; irq++) { + port->ptpmsg_irq[irq].num =3D irq_create_mapping(ptpirq->domain, irq); + if (!port->ptpmsg_irq[irq].num) { + ret =3D -EINVAL; + goto out; + } + } =20 ptpirq->irq_num =3D irq_find_mapping(port->pirq.domain, PORT_SRC_PTP_INT); if (!ptpirq->irq_num) { --=20 2.51.0