From: Stephen Boyd <stephen.boyd@linaro.org>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: [PATCH] i2c: Fix error print when address is invalid
Date: Mon, 23 Jan 2017 18:24:24 -0800 [thread overview]
Message-ID: <20170124022424.18212-1-stephen.boyd@linaro.org> (raw)
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
next reply other threads:[~2017-01-24 2:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 2:24 Stephen Boyd [this message]
2017-01-24 7:54 ` [PATCH] i2c: Fix error print when address is invalid 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=20170124022424.18212-1-stephen.boyd@linaro.org \
--to=stephen.boyd@linaro.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;
as well as URLs for NNTP newsgroup(s).