* [PATCH 1/2] serial: pic32_uart: do not free an IRQ that failed to be requested
2026-11-30 22:57 [PATCH 0/2] serial: pic32_uart: fix two error and remove paths Arina Kharlamova via B4 Relay
@ 2026-11-30 22:57 ` Arina Kharlamova via B4 Relay
2026-11-30 22:57 ` [PATCH 2/2] serial: pic32_uart: do not disable the clock in remove Arina Kharlamova via B4 Relay
2026-11-30 23:02 ` [PATCH 0/2] serial: pic32_uart: fix two error and remove paths sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-11-30 22:57 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Alan Cox, Joshua Henderson,
Ralf Baechle, Andrei Pistirica
Cc: linux-kernel, linux-serial, Arina Kharlamova
From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
When one of the three request_irq() calls in pic32_uart_startup()
fails, the error path jumps to the label that frees that same IRQ:
out_f after the fault IRQ, out_r after the RX IRQ and out_t after the
TX IRQ. free_irq() then finds no action for the port and warns
"Trying to free already-free IRQ".
Jump past the free_irq() of the IRQ that was not requested and only
free its name.
Fixes: 157b9394709e ("serial: pic32_uart: Add PIC32 UART driver")
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
drivers/tty/serial/pic32_uart.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index a645b646bf8d..6c8874e50fa4 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -498,7 +498,7 @@ static int pic32_uart_startup(struct uart_port *port)
dev_err(port->dev, "%s: request irq(%d) err! ret:%d name:%s\n",
__func__, sport->irq_fault, ret,
pic32_uart_type(port));
- goto out_f;
+ goto out_f_name;
}
sport->irq_rx_name = kasprintf(GFP_KERNEL, "%s%d-rx",
@@ -516,7 +516,7 @@ static int pic32_uart_startup(struct uart_port *port)
dev_err(port->dev, "%s: request irq(%d) err! ret:%d name:%s\n",
__func__, sport->irq_rx, ret,
pic32_uart_type(port));
- goto out_r;
+ goto out_r_name;
}
sport->irq_tx_name = kasprintf(GFP_KERNEL, "%s%d-tx",
@@ -557,13 +557,14 @@ static int pic32_uart_startup(struct uart_port *port)
return 0;
out_t:
- free_irq(sport->irq_tx, port);
kfree(sport->irq_tx_name);
out_r:
free_irq(sport->irq_rx, port);
+out_r_name:
kfree(sport->irq_rx_name);
out_f:
free_irq(sport->irq_fault, port);
+out_f_name:
kfree(sport->irq_fault_name);
out_disable_clk:
clk_disable_unprepare(sport->clk);
--
Git-157)
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] serial: pic32_uart: do not disable the clock in remove
2026-11-30 22:57 [PATCH 0/2] serial: pic32_uart: fix two error and remove paths Arina Kharlamova via B4 Relay
2026-11-30 22:57 ` [PATCH 1/2] serial: pic32_uart: do not free an IRQ that failed to be requested Arina Kharlamova via B4 Relay
@ 2026-11-30 22:57 ` Arina Kharlamova via B4 Relay
2026-11-30 23:02 ` [PATCH 0/2] serial: pic32_uart: fix two error and remove paths sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-11-30 22:57 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Alan Cox, Joshua Henderson,
Ralf Baechle, Andrei Pistirica
Cc: linux-kernel, linux-serial, Arina Kharlamova
From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
The UART clock is enabled by pic32_uart_startup() and by the console
setup. The first is undone by pic32_uart_shutdown(), the second in
probe. pic32_uart_remove() nevertheless calls clk_disable_unprepare()
after uart_remove_one_port() has shut the port down, so every unbind
drops an enable this driver no longer holds.
On PIC32MZDA this clock is PB2CLK, which the clock driver enables once
as a critical clock and which all UARTs share. The first unbind can
gate it while other users still need it, and later unbinds make the
clock core warn.
Drop the call from pic32_uart_remove().
Fixes: 157b9394709e ("serial: pic32_uart: Add PIC32 UART driver")
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
drivers/tty/serial/pic32_uart.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index 6c8874e50fa4..1dfee267c3ed 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -943,7 +943,6 @@ static void pic32_uart_remove(struct platform_device *pdev)
struct pic32_sport *sport = to_pic32_sport(port);
uart_remove_one_port(&pic32_uart_driver, port);
- clk_disable_unprepare(sport->clk);
platform_set_drvdata(pdev, NULL);
pic32_sports[sport->idx] = NULL;
}
--
Git-157)
^ permalink raw reply related [flat|nested] 4+ messages in thread