serial: pic32_uart: don't enable clock with interrupts disabled
Subsystems (2)
PATCH 1/1 serial: pic32_uart: don't enable clock with interrupts disabled
pic32_uart_startup() calls clk_prepare_enable() with interrupts disabled via local_irq_save(). clk_prepare() calls might_sleep() unconditionally, so this can sleep in atomic context.
Interrupts are only disabled to serialize the UART register initialization that follows; the clock must be enabled before those registers can be accessed anyway. Enable the clock before disabling interrupts.
--- drivers/tty/serial/pic32_uart.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/tty/serial/pic32_uart.c +3 -5
@@ -455,13 +455,11 @@ static int pic32_uart_startup(struct uart_port *port)unsigned long flags;int ret; -local_irq_save (flags); - ret =clk_prepare_enable (sport->clk); -if (ret) { -local_irq_restore (flags); +if (ret) goto out_done; - } + +local_irq_save (flags);/* clear status and mode registers */ pic32_uart_writel (sport,PIC32_UART_MODE ,0 );
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 4 lines
pic32_uart_startup()callsclk_prepare_enable()with interrupts disabled vialocal_irq_save().clk_prepare()callsmight_sleep()unconditionally, so this can sleep in atomic context.
Quoted 8 lines
Interrupts are only disabled to serialize the UART register initialization that follows; the clock must be enabled before those registers can be accessed anyway. Enable the clock before disabling interrupts.
Fixes 157b9394709e ("serial: pic32_uart: Add PIC32 UART driver")Signed-off-by Hyunjung Ko <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1