From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-i2c@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>
Subject: [PATCH 1/4] i2c: uniphier: error out if clock rate is zero
Date: Mon, 30 Nov 2015 18:53:33 +0900 [thread overview]
Message-ID: <1448877216-32286-2-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1448877216-32286-1-git-send-email-yamada.masahiro@socionext.com>
This input clock is used to generate the sampling clock for I2C bus.
If the clock rate is zero, there is something wrong with the clock
driver. Bail out with the appropriate error message in such a case.
It would make it easier to find the root cause of failure.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/i2c/busses/i2c-uniphier.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index e3c3861..2b2c20b 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -342,6 +342,10 @@ static int uniphier_i2c_clk_init(struct device *dev,
return ret;
clk_rate = clk_get_rate(priv->clk);
+ if (!clk_rate) {
+ dev_err(dev, "input clock rate should not be zero\n");
+ return -EINVAL;
+ }
uniphier_i2c_reset(priv, true);
@@ -388,7 +392,7 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
ret = uniphier_i2c_clk_init(dev, priv);
if (ret)
- return ret;
+ goto err;
ret = devm_request_irq(dev, irq, uniphier_i2c_interrupt, 0, pdev->name,
priv);
--
1.9.1
next prev parent reply other threads:[~2015-11-30 9:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 9:53 [PATCH 0/4] i2c: uniphier: add minor sanity checks to i2c-uniphier/i2c-uniphier-f Masahiro Yamada
2015-11-30 9:53 ` Masahiro Yamada [this message]
2015-11-30 9:53 ` [PATCH 2/4] i2c: uniphier: error out if bus speed is zero Masahiro Yamada
2015-11-30 9:53 ` [PATCH 3/4] i2c: uniphier_f: error out if clock rate " Masahiro Yamada
2015-11-30 9:53 ` [PATCH 4/4] i2c: uniphier_f: error out if bus speed " Masahiro Yamada
2015-12-14 10:01 ` [PATCH 0/4] i2c: uniphier: add minor sanity checks to i2c-uniphier/i2c-uniphier-f 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=1448877216-32286-2-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®