Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: pic32_uart: don't enable clock with interrupts disabled
@ 2026-11-18 11:15 Hyunjung Ko
  2026-11-18 11:20 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Hyunjung Ko @ 2026-11-18 11:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: linux-serial, linux-kernel, stable, Hyunjung Ko

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 <hj351016@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] serial: pic32_uart: don't enable clock with interrupts disabled
  2026-11-18 11:15 [PATCH] serial: pic32_uart: don't enable clock with interrupts disabled Hyunjung Ko
@ 2026-11-18 11:20 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-18 11:20 UTC (permalink / raw)
  To: Hyunjung Ko; +Cc: linux-serial

> 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 <hj351016@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118111521.1003717-1-hj351016@gmail.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 11:15 [PATCH] serial: pic32_uart: don't enable clock with interrupts disabled Hyunjung Ko
2026-11-18 11:20 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox