diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2016-04-03 23:32:00 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-04-07 21:13:38 +0200 |
commit | 34cf2acdafaa31a13821e45de5ee896adcd307b1 (patch) | |
tree | c8c875b5fb873558bd281632523fcc0eb3a7a487 /drivers | |
parent | i2c: mux: demux-pinctrl: Update docs to new sysfs-attributes (diff) | |
download | linux-34cf2acdafaa31a13821e45de5ee896adcd307b1.tar.xz linux-34cf2acdafaa31a13821e45de5ee896adcd307b1.zip |
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: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-jz4780.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index f325663c27c5..597408fc6834 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -770,7 +770,7 @@ static int jz4780_i2c_probe(struct platform_device *pdev) ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &clk_freq); - if (ret) { + if (ret || clk_freq == 0) { dev_err(&pdev->dev, "clock-frequency not specified in DT"); goto err; } |