* [PATCH] i2c: jz4780: prevent potential division by zero
@ 2016-04-03 21:32 Wolfram Sang
  0 siblings, 0 replies; only message in thread
From: Wolfram Sang @ 2016-04-03 21:32 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Zubair Lutfullah Kakakhel
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>
---
 drivers/i2c/busses/i2c-jz4780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index f325663c27c532..597408fc6834fc 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;
 	}
-- 
2.7.0
^ permalink raw reply related	[flat|nested] only message in thread
only message in thread, other threads:[~2016-04-03 21:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-03 21:32 [PATCH] i2c: jz4780: prevent potential division by zero Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).