]> git.itanic.dy.fi Git - linux-stable/commitdiff
clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate
authorStefan Wahren <stefan.wahren@i2se.com>
Sat, 25 Jun 2022 08:36:43 +0000 (10:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2022 10:04:51 +0000 (12:04 +0200)
[ Upstream commit 35f73cca1cecda0c1f8bb7d8be4ce5cd2d46ae8c ]

The function raspberrypi_fw_get_rate (e.g. used for the recalc_rate
hook) can fail to get the clock rate from the firmware. In this case
we cannot return a signed error value, which would be casted to
unsigned long. Fix this by returning 0 instead.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/20220625083643.4012-1-stefan.wahren@i2se.com
Fixes: 4e85e535e6cc ("clk: bcm283x: add driver interfacing with Raspberry Pi's firmware")
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/bcm/clk-raspberrypi.c

index 1654fd0eedc94d3b8d4240669d1e2fd7de8b5ccc..a790a8ca02ff4695086b5df1ad904d47b87cc737 100644 (file)
@@ -113,7 +113,7 @@ static unsigned long raspberrypi_fw_pll_get_rate(struct clk_hw *hw,
                                         RPI_FIRMWARE_ARM_CLK_ID,
                                         &val);
        if (ret)
-               return ret;
+               return 0;
 
        return val * RPI_FIRMWARE_PLLB_ARM_DIV_RATE;
 }