[PATCH] serial: 8250_uniphier: Use dev_err_probe() in probe error paths

From: Malathi A

Date: Fri Sep 18 2026 - 03:46:19 EST


devm_clk_get_enabled() returns -EPROBE_DEFER while the clock provider is
not registered yet, and uniphier_uart_probe() reports that with
dev_err(). Every retry of an intermittently deferred probe therefore
prints "failed to get and enable clock" at error level, which is only
dmesg noise.

Use dev_err_probe() instead: it demotes -EPROBE_DEFER to dev_dbg() and
records the reason for /sys/kernel/debug/devices_deferred. Convert the
other two error messages in probe as well, so the whole function follows
the "return dev_err_probe()" pattern already used by other 8250 drivers
such as 8250_em.c. Those two codes are never -EPROBE_DEFER, so there the
conversion is a readability change only.

Errors other than a deferral are still logged at error level, now with
the error code added by the helper. No functional change otherwise.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Signed-off-by: Malathi A <malathi.a2000@xxxxxxxxx>
---
This is the follow-up cleanup suggested during review of

[PATCH v2] serial: 8250_uniphier: Use devm_clk_get_enabled()

and it applies on top of that patch: the clock hunk relies on its
context. That fix is not in tty-next as of today, so this one should be
applied after it.

drivers/tty/serial/8250/8250_uniphier.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c
index 6fffac12277a..7d558b750f83 100644
--- a/drivers/tty/serial/8250/8250_uniphier.c
+++ b/drivers/tty/serial/8250/8250_uniphier.c
@@ -165,10 +165,8 @@ static int uniphier_uart_probe(struct platform_device *pdev)
int ret;

regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!regs) {
- dev_err(dev, "failed to get memory resource\n");
- return -EINVAL;
- }
+ if (!regs)
+ return dev_err_probe(dev, -EINVAL, "failed to get memory resource\n");

membase = devm_ioremap(dev, regs->start, resource_size(regs));
if (!membase)
@@ -181,10 +179,9 @@ static int uniphier_uart_probe(struct platform_device *pdev)
memset(&up, 0, sizeof(up));

priv->clk = devm_clk_get_enabled(dev, NULL);
- if (IS_ERR(priv->clk)) {
- dev_err(dev, "failed to get and enable clock\n");
- return PTR_ERR(priv->clk);
- }
+ if (IS_ERR(priv->clk))
+ return dev_err_probe(dev, PTR_ERR(priv->clk),
+ "failed to get and enable clock\n");

up.port.uartclk = clk_get_rate(priv->clk);

@@ -216,10 +213,9 @@ static int uniphier_uart_probe(struct platform_device *pdev)
up.dl_write = uniphier_serial_dl_write;

ret = serial8250_register_8250_port(&up);
- if (ret < 0) {
- dev_err(dev, "failed to register 8250 port\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "failed to register 8250 port\n");
+
priv->line = ret;

platform_set_drvdata(pdev, priv);
--
2.43.0