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


Groups > linux.kernel > #1565423 > unrolled thread

[PATCH] i2c: Fix error print when address is invalid

Started byStephen Boyd <stephen.boyd@linaro.org>
First post2017-01-24 03:30 +0100
Last post2017-01-24 09:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] i2c: Fix error print when address is invalid Stephen Boyd <stephen.boyd@linaro.org> - 2017-01-24 03:30 +0100
    Re: [PATCH] i2c: Fix error print when address is invalid Wolfram Sang <wsa@the-dreams.de> - 2017-01-24 09:00 +0100

#1565423 — [PATCH] i2c: Fix error print when address is invalid

FromStephen Boyd <stephen.boyd@linaro.org>
Date2017-01-24 03:30 +0100
Subject[PATCH] i2c: Fix error print when address is invalid
Message-ID<t2Z1T-6Az-1@gated-at.bofh.it>
When the address is invalid, we print out the address that's
in info.addr, but that member of info hasn't been assigned yet.
It's assigned in the line after we check the address. This causes
the print to show something like

     i2c i2c-1: of_i2c: invalid addr=0 on ...

when we want something like

     i2c i2c-1: of_i2c: invalid addr=0xaf on ...

Just pass addr here, and update the print format to indicate hex
as well.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
 drivers/i2c/i2c-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index cf9e396d7702..9fec1c232d68 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1707,8 +1707,8 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap,
 	}
 
 	if (i2c_check_addr_validity(addr, info.flags)) {
-		dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n",
-			info.addr, node->full_name);
+		dev_err(&adap->dev, "of_i2c: invalid addr=%#x on %s\n",
+			addr, node->full_name);
 		return ERR_PTR(-EINVAL);
 	}
 
-- 
2.10.0.297.gf6727b0

[toc] | [next] | [standalone]


#1565524

FromWolfram Sang <wsa@the-dreams.de>
Date2017-01-24 09:00 +0100
Message-ID<t34bf-1t2-9@gated-at.bofh.it>
In reply to#1565423

[Multipart message — attachments visible in raw view] — view raw

On Mon, Jan 23, 2017 at 06:24:24PM -0800, Stephen Boyd wrote:
> When the address is invalid, we print out the address that's
> in info.addr, but that member of info hasn't been assigned yet.
> It's assigned in the line after we check the address. This causes
> the print to show something like
> 
>      i2c i2c-1: of_i2c: invalid addr=0 on ...
> 
> when we want something like
> 
>      i2c i2c-1: of_i2c: invalid addr=0xaf on ...
> 
> Just pass addr here, and update the print format to indicate hex
> as well.
> 
> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>

Thanks, yet already fixed since v4.10-rc4 with 6f724fb3039522 ("i2c:
print correct device invalid address").

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web