]> www.infradead.org Git - users/hch/misc.git/commitdiff
clk: bcm: rpi: Add missing logs if firmware fails
authorStefan Wahren <wahrenst@gmx.net>
Thu, 31 Jul 2025 21:06:17 +0000 (18:06 -0300)
committerStephen Boyd <sboyd@kernel.org>
Sun, 21 Sep 2025 16:09:21 +0000 (09:09 -0700)
In contrary to raspberrypi_fw_set_rate(), the ops for is_prepared() and
recalc_rate() silently ignore firmware errors by just returning 0.
Since these operations should never fail, add at least error logs
to inform the user.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: MaĆ­ra Canal <mcanal@igalia.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/bcm/clk-raspberrypi.c

index 8e4fde03ed232b464165f524d27744b4ced93a60..166d0bec380310e8b98f91568efa4aa88401af4f 100644 (file)
@@ -194,8 +194,11 @@ static int raspberrypi_fw_is_prepared(struct clk_hw *hw)
 
        ret = raspberrypi_clock_property(rpi->firmware, data,
                                         RPI_FIRMWARE_GET_CLOCK_STATE, &val);
-       if (ret)
+       if (ret) {
+               dev_err_ratelimited(rpi->dev, "Failed to get %s state: %d\n",
+                                   clk_hw_get_name(hw), ret);
                return 0;
+       }
 
        return !!(val & RPI_FIRMWARE_STATE_ENABLE_BIT);
 }
@@ -211,8 +214,11 @@ static unsigned long raspberrypi_fw_get_rate(struct clk_hw *hw,
 
        ret = raspberrypi_clock_property(rpi->firmware, data,
                                         RPI_FIRMWARE_GET_CLOCK_RATE, &val);
-       if (ret)
+       if (ret) {
+               dev_err_ratelimited(rpi->dev, "Failed to get %s frequency: %d\n",
+                                   clk_hw_get_name(hw), ret);
                return 0;
+       }
 
        return val;
 }