Skip to content
Snippets Groups Projects
Commit 34cf2acd authored by Wolfram Sang's avatar Wolfram Sang
Browse files

i2c: jz4780: prevent potential division by zero


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: default avatarWolfram Sang <wsa@the-dreams.de>
parent 39b132b0
No related branches found
No related tags found
No related merge requests found
...@@ -770,7 +770,7 @@ static int jz4780_i2c_probe(struct platform_device *pdev) ...@@ -770,7 +770,7 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
&clk_freq); &clk_freq);
if (ret) { if (ret || clk_freq == 0) {
dev_err(&pdev->dev, "clock-frequency not specified in DT"); dev_err(&pdev->dev, "clock-frequency not specified in DT");
goto err; goto err;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment