Skip to content

Commit 29e8a0c

Browse files
Wenhua Lingregkh
authored andcommitted
serial: sprd: Return -EPROBE_DEFER when uart clock is not ready
In sprd_clk_init(), when devm_clk_get() returns -EPROBE_DEFER for either uart or source clock, we should propagate the error instead of just warning and continuing with NULL clocks. Currently the driver only emits a warning when clock acquisition fails and proceeds with NULL clock pointers. This can lead to issues later when the clocks are actually needed. More importantly, when the clock provider is not ready yet and returns -EPROBE_DEFER, we should return this error to allow deferred probing. This change adds explicit checks for -EPROBE_DEFER after both: 1. devm_clk_get(uport->dev, uart) 2. devm_clk_get(uport->dev, source) When -EPROBE_DEFER is encountered, the function now returns -EPROBE_DEFER to let the driver framework retry probing later when the clock dependencies are resolved. Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com> Link: https://patch.msgid.link/20251022030840.956589-1-Wenhua.Lin@unisoc.com Reviewed-by: Cixi Geng <cixi.geng@linux.dev> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f0a6e93 commit 29e8a0c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/tty/serial/sprd_serial.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,13 +1133,19 @@ static int sprd_clk_init(struct uart_port *uport)
11331133

11341134
clk_uart = devm_clk_get(uport->dev, "uart");
11351135
if (IS_ERR(clk_uart)) {
1136+
if (PTR_ERR(clk_uart) == -EPROBE_DEFER)
1137+
return -EPROBE_DEFER;
1138+
11361139
dev_warn(uport->dev, "uart%d can't get uart clock\n",
11371140
uport->line);
11381141
clk_uart = NULL;
11391142
}
11401143

11411144
clk_parent = devm_clk_get(uport->dev, "source");
11421145
if (IS_ERR(clk_parent)) {
1146+
if (PTR_ERR(clk_parent) == -EPROBE_DEFER)
1147+
return -EPROBE_DEFER;
1148+
11431149
dev_warn(uport->dev, "uart%d can't get source clock\n",
11441150
uport->line);
11451151
clk_parent = NULL;

0 commit comments

Comments
 (0)