Commit 7890fce6 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: riic: avoid potential division by zero

Value comes from DT, so it could be 0. Unlikely, but could be.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 3c417c94
...@@ -313,7 +313,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t) ...@@ -313,7 +313,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t)
* frequency with only 62 clock ticks max (31 high, 31 low). * frequency with only 62 clock ticks max (31 high, 31 low).
* Aim for a duty of 60% LOW, 40% HIGH. * Aim for a duty of 60% LOW, 40% HIGH.
*/ */
total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz); total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz ?: 1);
for (cks = 0; cks < 7; cks++) { for (cks = 0; cks < 7; cks++) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment