i2c: jz4780: Return error if clk_freq is set to 0
Subsystems (2)
PATCH 1/1 i2c: jz4780: Return error if clk_freq is set to 0
Current code returns 0 in probe if clk_freq is set to 0. As a result, the probe success but the module does not work. Fix it.
Fixes 34cf2acdafaa ("i2c: jz4780: prevent potential division by zero")
Signed-off-by Axel Lin <[email protected]>
--- drivers/i2c/busses/i2c-jz4780.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-jz4780.c +2 -0
@@ -772,6 +772,8 @@ static int jz4780_i2c_probe(struct platform_device *pdev) &clk_freq);if (ret || clk_freq ==0 ) {dev_err (&pdev->dev,"clock-frequency not specified in DT" ); +if (ret ==0 ) + ret = -EINVAL ; goto err; }
Signature · 1 line
2.1.4
Quoted 5 lines · Axel Lin
Current code returns 0 in probe if
clk_freqis set to 0. As a result, the probe success but the module does not work. Fix it.Fixes 34cf2acdafaa ("i2c: jz4780: prevent potential division by zero")Signed-off-by Axel Lin <[email protected]>
True, thanks for the pointer! However, I think we should also check i2c->speed directly. I'll send a patch right now. Please let me know if you agree on that one.