summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/pic32_uart.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2022-05-03 09:31:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-05 23:39:19 +0300
commitfe36fa18ca77ca3ca9f90aab6cf39031416e432b (patch)
treee9eb2d48ee5e8bb40c138053bc3b46d06e615a7d /drivers/tty/serial/pic32_uart.c
parent28dc563339b181461494918d5d155e3ebc9a87ec (diff)
downloadlinux-fe36fa18ca77ca3ca9f90aab6cf39031416e432b.tar.xz
serial: pic32: free up irq names correctly
struct pic32_sport contains built-up names for irqs. These are freed only in error path of pic32_uart_startup(). And even there, the freeing happens before free_irq(). So fix this by: * moving frees after free_irq(), and * add frees to pic32_uart_shutdown() -- the opposite of pic32_uart_startup(). Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220503063122.20957-11-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/pic32_uart.c')
-rw-r--r--drivers/tty/serial/pic32_uart.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index 990603fe8a8d..c5584628f8c4 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -569,14 +569,14 @@ static int pic32_uart_startup(struct uart_port *port)
return 0;
out_t:
- kfree(sport->irq_tx_name);
free_irq(sport->irq_tx, port);
+ kfree(sport->irq_tx_name);
out_r:
- kfree(sport->irq_rx_name);
free_irq(sport->irq_rx, port);
+ kfree(sport->irq_rx_name);
out_f:
- kfree(sport->irq_fault_name);
free_irq(sport->irq_fault, port);
+ kfree(sport->irq_fault_name);
out_done:
return ret;
}
@@ -595,8 +595,11 @@ static void pic32_uart_shutdown(struct uart_port *port)
/* free all 3 interrupts for this UART */
free_irq(sport->irq_fault, port);
+ kfree(sport->irq_fault_name);
free_irq(sport->irq_tx, port);
+ kfree(sport->irq_tx_name);
free_irq(sport->irq_rx, port);
+ kfree(sport->irq_rx_name);
}
/* serial core request to change current uart setting */