From: Axel Lin <axel.lin@ingics.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>,
linux-i2c@vger.kernel.org
Subject: [PATCH] i2c: jz4780: Return error if clk_freq is set to 0
Date: Fri, 08 Apr 2016 15:59:32 +0800 [thread overview]
Message-ID: <1460102372.5233.1.camel@ingics.com> (raw)
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
next reply other threads:[~2016-04-08 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 7:59 Axel Lin [this message]
2016-04-08 9:55 ` [PATCH] i2c: jz4780: Return error if clk_freq is set to 0 Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460102372.5233.1.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=Zubair.Kakakhel@imgtec.com \
--cc=linux-i2c@vger.kernel.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.