rtc: zynqmp: Return optional clock lookup errors
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Wed, 24 Jun 2026 05:55:24 +0000 (13:55 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 19 Aug 2026 15:42:05 +0000 (17:42 +0200)
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>
Fixes: 07dcc6f9c762 ("rtc: zynqmp: Add calibration set and get support")
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://patch.msgid.link/20260624055524.38522-1-pengpeng@iscas.ac.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-zynqmp.c

index 2ae5480..5bcb753 100644 (file)
@@ -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",