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. Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx> --- Hi Uwe, If my understand is correct, you prefer to make it return error rather than using default frequency setting if DT setting is wrong. v2: Make probe return error instead of using default frequency. drivers/i2c/busses/i2c-efm32.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/busses/i2c-efm32.c b/drivers/i2c/busses/i2c-efm32.c index 8eff627..7c0636e 100644 --- a/drivers/i2c/busses/i2c-efm32.c +++ b/drivers/i2c/busses/i2c-efm32.c @@ -395,6 +395,13 @@ static int efm32_i2c_probe(struct platform_device *pdev) frequency = 100000; dev_info(&pdev->dev, "defaulting to 100 kHz\n"); } + + if (frequency == 0) { + dev_err(&pdev->dev, "Invalid clock-frequency\n"); + ret = -EINVAL; + goto err_disable_clk; + } + ddata->frequency = frequency; rate = clk_get_rate(ddata->clk); -- 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