Make sure we don't OOPS in case clock-frequency is set to 0 in a DT. The variable set here is later used as a divisor. Since the clock-frequency property is optional in current code, use SIRFSOC_I2C_DEFAULT_SPEED instead if clock-frequency is set to 0 in a DT. Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx> --- drivers/i2c/busses/i2c-sirf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c index 792a42b..82743e4 100644 --- a/drivers/i2c/busses/i2c-sirf.c +++ b/drivers/i2c/busses/i2c-sirf.c @@ -353,7 +353,7 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) err = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &bitrate); - if (err < 0) + if (err < 0 || bitrate == 0) bitrate = SIRFSOC_I2C_DEFAULT_SPEED; /* -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html