[PATCH master] serial: stm32: suppress -EPROBE_DEFER messages using dev_err_probe

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jun 11 01:27:14 PDT 2024


A return code of -EPROBE_DEFER is not necessarily an error as the clock
driver may indeed be probed later. Use dev_err_probe to silence the
error message in this situation and to store it for later use if the
probe is deferred permanently.

Co-developed-by: Sven Püschel <s.pueschel at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/serial/serial_stm32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 3e18a2c152af..eebae6f6ee9e 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -167,14 +167,14 @@ static int stm32_serial_probe(struct device *dev)
 
 	stm32->clk = clk_get_for_console(dev, NULL);
 	if (IS_ERR(stm32->clk)) {
-		ret = PTR_ERR(stm32->clk);
-		dev_err(dev, "Failed to get UART clock %d\n", ret);
+		ret = dev_err_probe(dev, PTR_ERR(stm32->clk),
+				    "Failed to get UART clock\n");
 		goto io_release;
 	}
 
 	ret = clk_enable(stm32->clk);
 	if (ret) {
-		dev_err(dev, "Failed to enable UART clock %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to enable UART clock\n");
 		goto io_release;
 	}
 
-- 
2.39.2




More information about the barebox mailing list