summaryrefslogtreecommitdiffstats
path: root/hw/p8-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/p8-i2c.c')
-rw-r--r--hw/p8-i2c.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 848d4008..66510f11 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1036,6 +1036,7 @@ static void p8_i2c_free_request(struct i2c_request *req)
static inline uint32_t p8_i2c_get_bit_rate_divisor(uint32_t lb_freq,
uint32_t bus_speed)
{
+ assert(bus_speed > 0);
return (((lb_freq / bus_speed) - 1) / 4);
}
@@ -1043,6 +1044,8 @@ static inline uint64_t p8_i2c_get_poll_interval(uint32_t bus_speed)
{
uint64_t usec;
+ assert(bus_speed > 0);
+
/* Polling Interval = 8 * (1/bus_speed) * (1/10) -> convert to uSec */
usec = ((8 * USEC_PER_SEC) / (10 * bus_speed));
return usecs_to_tb(usec);
OpenPOWER on IntegriCloud