]> git.ipfire.org Git - thirdparty/linux.git/commit
net: dsa: microchip: Free previously initialized ports on init failures
authorBastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Thu, 20 Nov 2025 09:12:03 +0000 (10:12 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 25 Nov 2025 11:32:41 +0000 (12:32 +0100)
commit0f80e21bf6229637e193248fbd284c0ec44bc0fd
treee0ba0e3ff28bd4e2899a3fdf6e5606bac05c081d
parent25b62cc5b22c45face094ae3e8717258e46d1d19
net: dsa: microchip: Free previously initialized ports on init failures

If a port interrupt setup fails after at least one port has already been
successfully initialized, the gotos miss some resource releasing:
- the already initialized PTP IRQs aren't released
- the already initialized port IRQs aren't released if the failure
occurs in ksz_pirq_setup().

Merge 'out_girq' and 'out_ptpirq' into a single 'port_release' label.
Behind this label, use the reverse loop to release all IRQ resources
for all initialized ports.
Jump in the middle of the reverse loop if an error occurs in
ksz_ptp_irq_setup() to only release the port IRQ of the current
iteration.

Cc: stable@vger.kernel.org
Fixes: c9cd961c0d43 ("net: dsa: microchip: lan937x: add interrupt support for port phy link")
Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20251120-ksz-fix-v6-4-891f80ae7f8f@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/dsa/microchip/ksz_common.c