* [PATCH] i2c: jz4780: Return error if clk_freq is set to 0
@ 2016-04-08 7:59 Axel Lin
2016-04-08 9:55 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2016-04-08 7:59 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Zubair Lutfullah Kakakhel, linux-i2c
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 <axel.lin@ingics.com>
---
drivers/i2c/busses/i2c-jz4780.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index 597408f..0b3ba8d 100644
--- a/drivers/i2c/busses/i2c-jz4780.c
+++ b/drivers/i2c/busses/i2c-jz4780.c
@@ -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;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: jz4780: Return error if clk_freq is set to 0
2016-04-08 7:59 [PATCH] i2c: jz4780: Return error if clk_freq is set to 0 Axel Lin
@ 2016-04-08 9:55 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2016-04-08 9:55 UTC (permalink / raw)
To: Axel Lin; +Cc: Zubair Lutfullah Kakakhel, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
On Fri, Apr 08, 2016 at 03:59:32PM +0800, Axel Lin wrote:
> 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 <axel.lin@ingics.com>
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-08 9:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 7:59 [PATCH] i2c: jz4780: Return error if clk_freq is set to 0 Axel Lin
2016-04-08 9:55 ` Wolfram Sang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.