提交 1c6c7b6b 编写于 作者: S Simon Glass

tegra: clock: Avoid a divide-by-zero error

The clock fix-up for tegra is still present in the code. It causes a
divide-by-zero bug after relocation when chain-loading U-Boot from
coreboot. Fix this by adding a check.
Signed-off-by: NSimon Glass <sjg@chromium.org>
Fixes: 74686766 (ARM: tegra: fix clock_get_periph_rate() for UART clocks)
上级 06cc85a2
......@@ -339,8 +339,11 @@ unsigned long clock_get_periph_rate(enum periph_id periph_id,
* return value doesn't help. In summary this clock driver is
* quite broken but I'm afraid I have no idea how to fix it
* without completely replacing it.
*
* Be careful to avoid a divide by zero error.
*/
div -= 2;
if (div >= 1)
div -= 2;
break;
#endif
default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册