* [PATCH] serial: 8250_uniphier: Use dev_err_probe() in probe error paths
@ 2026-09-18 7:45 Malathi A
2026-09-18 9:41 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Malathi A @ 2026-09-18 7:45 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Kunihiko Hayashi, Masami Hiramatsu
Cc: Andy Shevchenko, linux-serial, linux-kernel, linux-arm-kernel, Malathi A
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@linux.intel.com>
Signed-off-by: Malathi A <malathi.a2000@gmail.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: 8250_uniphier: Use dev_err_probe() in probe error paths
2026-09-18 7:45 [PATCH] serial: 8250_uniphier: Use dev_err_probe() in probe error paths Malathi A
@ 2026-09-18 9:41 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-09-18 9:41 UTC (permalink / raw)
To: Malathi A
Cc: Greg Kroah-Hartman, Jiri Slaby, Kunihiko Hayashi,
Masami Hiramatsu, linux-serial, linux-kernel, linux-arm-kernel
On Fri, Sep 18, 2026 at 07:45:46AM +0000, Malathi A wrote:
> 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.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-18 9:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 7:45 [PATCH] serial: 8250_uniphier: Use dev_err_probe() in probe error paths Malathi A
2026-09-18 9:41 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®