linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate
@ 2022-06-25  8:36 Stefan Wahren
  2022-06-27 16:24 ` Florian Fainelli
  2022-08-23  2:17 ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Wahren @ 2022-06-25  8:36 UTC (permalink / raw)
  To: Florian Fainelli, Michael Turquette, Stephen Boyd
  Cc: bcm-kernel-feedback-list, Maxime Ripard, linux-clk,
	linux-arm-kernel, linux-kernel, 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.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/clk/bcm/clk-raspberrypi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
index 73518009a0f2..39d63c983d62 100644
--- a/drivers/clk/bcm/clk-raspberrypi.c
+++ b/drivers/clk/bcm/clk-raspberrypi.c
@@ -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;
 }
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-23  2:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-25  8:36 [PATCH] clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate Stefan Wahren
2022-06-27 16:24 ` Florian Fainelli
2022-08-05  8:32   ` Stefan Wahren
2022-08-23  2:17 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).