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. Fixes: 157b9394709e ("serial: pic32_uart: Add PIC32 UART driver") Cc: stable@vger.kernel.org Signed-off-by: Hyunjung Ko --- drivers/tty/serial/pic32_uart.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c index 8407f85776c0..a8010d6b65ba 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -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); -- 2.43.0