[PATCH 2/4] ARM: imx: clocksource: error out if clk freq is 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If instead this isn't checked this results in a division by zero later.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 arch/arm/mach-imx/clocksource.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c
index 17762c3caf25..793f84ee4800 100644
--- a/arch/arm/mach-imx/clocksource.c
+++ b/arch/arm/mach-imx/clocksource.c
@@ -121,6 +121,10 @@ static int imx_gpt_probe(struct device_d *dev)
 		dev_err(dev, "failed to get clock\n");
 	} else {
 		rate = clk_get_rate(clk_gpt);
+		if (!rate) {
+			dev_err(dev, "clock reports rate == 0\n");
+			return -EIO;
+		}
 	}
 
 	writel(0, timer_base + GPT_TPRER);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux