Skip to contentSkip to conversation

clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate

PATCH Applied Stefan Wahren 3 participants 4 messages Jun 25, 2022 – Aug 23, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate

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.

---
 drivers/clk/bcm/clk-raspberrypi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/bcm/clk-raspberrypi.c +1 -1
index 73518009a0f2..39d63c983d62 100644
@@ -203,7 +203,7 @@ 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)
-		return ret;
+		return 0;
 
 	return val;
 }
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Stefan Wahren

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.

Fixes 4e85e535e6cc ("clk: bcm283x: add driver interfacing with Raspberry Pi's firmware")
Signature · 1 line
Florian
#2 lore raw

Am 27.06.22 um 18:24 schrieb Florian Fainelli:

Quoted 11 lines · Stefan Wahren
Quoted 6 lines

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.

Fixes 4e85e535e6cc ("clk: bcm283x: add driver interfacing with Raspberry Pi's firmware")

gentle ping

maintainer Applied
#3 lore raw
In reply to Stefan Wahren

Quoting Stefan Wahren (2022-06-25 01:36:43)

Quoted 7 lines

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.

---

Applied to clk-fixes