diff mbox

i2c: rcar: remove sign-compare flaw

Message ID 1411207657-23707-1-git-send-email-wsa@the-dreams.de (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Wolfram Sang Sept. 20, 2014, 10:07 a.m. UTC
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

gcc rightfully says:

drivers/i2c/busses/i2c-rcar.c:198:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Sept. 28, 2014, 11:15 p.m. UTC | #1
Hi Wolfram,

Thank you for the patch.

On Saturday 20 September 2014 12:07:37 Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> gcc rightfully says:
> 
> drivers/i2c/busses/i2c-rcar.c:198:10: warning: comparison between signed and
> unsigned integer expressions [-Wsign-compare]
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  drivers/i2c/busses/i2c-rcar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 4c6fa78063fb..1eed463662c4 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -195,7 +195,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv
> *priv, */
>  	rate = clk_get_rate(priv->clk);
>  	cdf = rate / 20000000;
> -	if (cdf >= 1 << cdf_width) {
> +	if (cdf >= 1U << cdf_width) {
>  		dev_err(dev, "Input clock %lu too high\n", rate);
>  		return -EIO;
>  	}
Wolfram Sang Sept. 29, 2014, 8:44 p.m. UTC | #2
On Sat, Sep 20, 2014 at 12:07:37PM +0200, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> gcc rightfully says:
> 
> drivers/i2c/busses/i2c-rcar.c:198:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 4c6fa78063fb..1eed463662c4 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -195,7 +195,7 @@  static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
 	 */
 	rate = clk_get_rate(priv->clk);
 	cdf = rate / 20000000;
-	if (cdf >= 1 << cdf_width) {
+	if (cdf >= 1U << cdf_width) {
 		dev_err(dev, "Input clock %lu too high\n", rate);
 		return -EIO;
 	}