* [PATCH] rtc: zynqmp: Return optional clock lookup errors
@ 2026-06-24 5:55 Pengpeng Hou
2026-06-26 12:42 ` Michal Simek
2026-08-19 16:30 ` Alexandre Belloni
0 siblings, 2 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-06-24 5:55 UTC (permalink / raw)
To: Alexandre Belloni, Michal Simek
Cc: linux-rtc, linux-arm-kernel, linux-kernel, Pengpeng Hou
devm_clk_get_optional() returns NULL when the optional clock is absent,
but returns an ERR_PTR when the clock provider lookup fails. Probe
currently keeps the ERR_PTR and then passes it to clk_get_rate().
Return the lookup error instead. A truly absent optional clock still
reaches the existing calibration fallback through clk_get_rate(NULL).
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/rtc/rtc-zynqmp.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 2ae54804b87a..5bcb7536e973 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -334,10 +334,9 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
/* Getting the rtc info */
xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc");
- if (IS_ERR(xrtcdev->rtc_clk)) {
- if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER)
- dev_warn(&pdev->dev, "Device clock not found.\n");
- }
+ if (IS_ERR(xrtcdev->rtc_clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(xrtcdev->rtc_clk),
+ "Failed to get rtc clock\n");
xrtcdev->freq = clk_get_rate(xrtcdev->rtc_clk);
if (!xrtcdev->freq) {
ret = of_property_read_u32(pdev->dev.of_node, "calibration",
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: zynqmp: Return optional clock lookup errors
2026-06-24 5:55 [PATCH] rtc: zynqmp: Return optional clock lookup errors Pengpeng Hou
@ 2026-06-26 12:42 ` Michal Simek
2026-08-19 16:30 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2026-06-26 12:42 UTC (permalink / raw)
To: Pengpeng Hou, Alexandre Belloni; +Cc: linux-rtc, linux-arm-kernel, linux-kernel
On 6/24/26 07:55, Pengpeng Hou wrote:
> devm_clk_get_optional() returns NULL when the optional clock is absent,
> but returns an ERR_PTR when the clock provider lookup fails. Probe
> currently keeps the ERR_PTR and then passes it to clk_get_rate().
>
> Return the lookup error instead. A truly absent optional clock still
> reaches the existing calibration fallback through clk_get_rate(NULL).
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> drivers/rtc/rtc-zynqmp.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
> index 2ae54804b87a..5bcb7536e973 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -334,10 +334,9 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
>
> /* Getting the rtc info */
> xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc");
> - if (IS_ERR(xrtcdev->rtc_clk)) {
> - if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER)
> - dev_warn(&pdev->dev, "Device clock not found.\n");
> - }
> + if (IS_ERR(xrtcdev->rtc_clk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(xrtcdev->rtc_clk),
> + "Failed to get rtc clock\n");
> xrtcdev->freq = clk_get_rate(xrtcdev->rtc_clk);
> if (!xrtcdev->freq) {
> ret = of_property_read_u32(pdev->dev.of_node, "calibration",
Fixes: 07dcc6f9c762 ("rtc: zynqmp: Add calibration set and get support")
cc: stable@kernel.org
Reviewed-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: zynqmp: Return optional clock lookup errors
2026-06-24 5:55 [PATCH] rtc: zynqmp: Return optional clock lookup errors Pengpeng Hou
2026-06-26 12:42 ` Michal Simek
@ 2026-08-19 16:30 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2026-08-19 16:30 UTC (permalink / raw)
To: Michal Simek, Pengpeng Hou; +Cc: linux-rtc, linux-arm-kernel, linux-kernel
On Wed, 24 Jun 2026 13:55:24 +0800, Pengpeng Hou wrote:
> devm_clk_get_optional() returns NULL when the optional clock is absent,
> but returns an ERR_PTR when the clock provider lookup fails. Probe
> currently keeps the ERR_PTR and then passes it to clk_get_rate().
>
> Return the lookup error instead. A truly absent optional clock still
> reaches the existing calibration fallback through clk_get_rate(NULL).
>
> [...]
Applied, thanks!
[1/1] rtc: zynqmp: Return optional clock lookup errors
https://git.kernel.org/abelloni/c/5904c4109554
Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-19 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24 5:55 [PATCH] rtc: zynqmp: Return optional clock lookup errors Pengpeng Hou
2026-06-26 12:42 ` Michal Simek
2026-08-19 16:30 ` Alexandre Belloni
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®