diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2023-09-06 23:00:23 +0300 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2023-09-19 12:11:09 +0300 |
commit | 7890fce6201aed46d3576e3d641f9ee5c1f0e16f (patch) | |
tree | c1eaf0eb2462d9f7f42c7780215670785f39d95b /drivers/i2c | |
parent | 3c417c947c13f22e60a4c3e68a7219a134219925 (diff) | |
download | linux-7890fce6201aed46d3576e3d641f9ee5c1f0e16f.tar.xz |
i2c: riic: avoid potential division by zero
Value comes from DT, so it could be 0. Unlikely, but could be.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-riic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index f0ee8871d5ae..e43ff483c56e 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -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). * 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++) { /* |