From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Wenhua Lin <Wenhua.Lin@unisoc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Cixi Geng <cixi.geng@linux.dev>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
wenhua lin <wenhua.lin1994@gmail.com>,
Xiongpeng Wu <xiongpeng.wu@unisoc.com>,
Zhaochen Su <Zhaochen.Su@unisoc.com>,
Zhirong Qiu <Zhirong.Qiu@unisoc.com>
Subject: Re: [PATCH] serial: sprd: Return -EPROBE_DEFER when uart clock is not ready
Date: Wed, 26 Nov 2025 13:57:39 +0100 [thread overview]
Message-ID: <aSb5Q0Giq8p43n_o@black.igk.intel.com> (raw)
In-Reply-To: <20251022030840.956589-1-Wenhua.Lin@unisoc.com>
On Wed, Oct 22, 2025 at 11:08:40AM +0800, Wenhua Lin wrote:
> 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.
...
> clk_uart = devm_clk_get(uport->dev, "uart");
> if (IS_ERR(clk_uart)) {
> + if (PTR_ERR(clk_uart) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> +
> dev_warn(uport->dev, "uart%d can't get uart clock\n",
> uport->line);
> clk_uart = NULL;
AFAICS this still ignores other issues, what should be done here is to
replace devm_clk_get() by devm_clk_get_optional() and drop this NULL
assignment.
...
> clk_parent = devm_clk_get(uport->dev, "source");
> if (IS_ERR(clk_parent)) {
> + if (PTR_ERR(clk_parent) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> +
> dev_warn(uport->dev, "uart%d can't get source clock\n",
> uport->line);
> clk_parent = NULL;
Ditto.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-26 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 3:08 [PATCH] serial: sprd: Return -EPROBE_DEFER when uart clock is not ready Wenhua Lin
2025-10-22 6:55 ` Chunyan Zhang
2025-10-23 2:10 ` wenhua lin
2025-10-24 1:42 ` Chunyan Zhang
2025-11-10 3:05 ` wenhua lin
2025-11-26 12:57 ` Andy Shevchenko [this message]
2025-11-27 8:44 ` wenhua lin
2025-11-27 9:05 ` Andy Shevchenko
2025-12-10 6:48 ` wenhua lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aSb5Q0Giq8p43n_o@black.igk.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Wenhua.Lin@unisoc.com \
--cc=Zhaochen.Su@unisoc.com \
--cc=Zhirong.Qiu@unisoc.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=cixi.geng@linux.dev \
--cc=conor+dt@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=robh@kernel.org \
--cc=wenhua.lin1994@gmail.com \
--cc=xiongpeng.wu@unisoc.com \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox