Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279737 > unrolled thread

[PATCH 0/4] i2c: uniphier: add minor sanity checks to i2c-uniphier/i2c-uniphier-f

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2015-11-30 11:00 +0100
Last post2015-11-30 11:00 +0100
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] i2c: uniphier: add minor sanity checks to i2c-uniphier/i2c-uniphier-f Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 11:00 +0100
    [PATCH 2/4] i2c: uniphier: error out if bus speed is zero Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 11:00 +0100
    [PATCH 4/4] i2c: uniphier_f: error out if bus speed is zero Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 11:00 +0100
    [PATCH 3/4] i2c: uniphier_f: error out if clock rate is zero Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 11:00 +0100

#1279737 — [PATCH 0/4] i2c: uniphier: add minor sanity checks to i2c-uniphier/i2c-uniphier-f

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-11-30 11:00 +0100
Subject[PATCH 0/4] i2c: uniphier: add minor sanity checks to i2c-uniphier/i2c-uniphier-f
Message-ID<qAtpv-1UE-1@gated-at.bofh.it>


Masahiro Yamada (4):
  i2c: uniphier: error out if clock rate is zero
  i2c: uniphier: error out if bus speed is zero
  i2c: uniphier_f: error out if clock rate is zero
  i2c: uniphier_f: error out if bus speed is zero

 drivers/i2c/busses/i2c-uniphier-f.c | 11 ++++++++++-
 drivers/i2c/busses/i2c-uniphier.c   | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1279738 — [PATCH 2/4] i2c: uniphier: error out if bus speed is zero

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-11-30 11:00 +0100
Subject[PATCH 2/4] i2c: uniphier: error out if bus speed is zero
Message-ID<qAtpv-1UE-3@gated-at.bofh.it>
In reply to#1279737
There is code to divide by "bus_speed" some lines below.
To eliminate the possibility of division by zero, bail out if
"clock-frequency" is specified as zero.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/i2c/busses/i2c-uniphier.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index 2b2c20b..1f4f3f5 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -327,6 +327,11 @@ static int uniphier_i2c_clk_init(struct device *dev,
 	if (of_property_read_u32(np, "clock-frequency", &bus_speed))
 		bus_speed = UNIPHIER_I2C_DEFAULT_SPEED;
 
+	if (!bus_speed) {
+		dev_err(dev, "clock-freqyency should not be zero\n");
+		return -EINVAL;
+	}
+
 	if (bus_speed > UNIPHIER_I2C_MAX_SPEED)
 		bus_speed = UNIPHIER_I2C_MAX_SPEED;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1279739 — [PATCH 4/4] i2c: uniphier_f: error out if bus speed is zero

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-11-30 11:00 +0100
Subject[PATCH 4/4] i2c: uniphier_f: error out if bus speed is zero
Message-ID<qAtpw-1UE-7@gated-at.bofh.it>
In reply to#1279737
There is code to divide by "bus_speed" some lines below.
To eliminate the possibility of division by zero, bail out if
"clock-frequency" is specified as zero.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/i2c/busses/i2c-uniphier-f.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
index 67109e1..f3e5ff8 100644
--- a/drivers/i2c/busses/i2c-uniphier-f.c
+++ b/drivers/i2c/busses/i2c-uniphier-f.c
@@ -466,6 +466,11 @@ static int uniphier_fi2c_clk_init(struct device *dev,
 	if (of_property_read_u32(np, "clock-frequency", &bus_speed))
 		bus_speed = UNIPHIER_FI2C_DEFAULT_SPEED;
 
+	if (!bus_speed) {
+		dev_err(dev, "clock-freqyency should not be zero\n");
+		return -EINVAL;
+	}
+
 	if (bus_speed > UNIPHIER_FI2C_MAX_SPEED)
 		bus_speed = UNIPHIER_FI2C_MAX_SPEED;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1279740 — [PATCH 3/4] i2c: uniphier_f: error out if clock rate is zero

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2015-11-30 11:00 +0100
Subject[PATCH 3/4] i2c: uniphier_f: error out if clock rate is zero
Message-ID<qAtpx-1UE-15@gated-at.bofh.it>
In reply to#1279737
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-f.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
index e8d03bc..67109e1 100644
--- a/drivers/i2c/busses/i2c-uniphier-f.c
+++ b/drivers/i2c/busses/i2c-uniphier-f.c
@@ -481,6 +481,10 @@ static int uniphier_fi2c_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_fi2c_reset(priv);
 
@@ -531,7 +535,7 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
 
 	ret = uniphier_fi2c_clk_init(dev, priv);
 	if (ret)
-		return ret;
+		goto err;
 
 	ret = devm_request_irq(dev, irq, uniphier_fi2c_interrupt, 0,
 			       pdev->name, priv);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web