From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] i2c: read/write_reg: don't assume client->dev to be valid
Date: Thu, 25 Jan 2018 08:15:13 +0100 [thread overview]
Message-ID: <20180125071513.3o27lvaxwtnmph64@pengutronix.de> (raw)
In-Reply-To: <20180122105958.15354-1-u.kleine-koenig@pengutronix.de>
On Mon, Jan 22, 2018 at 11:59:58AM +0100, Uwe Kleine-König wrote:
> When using the barebox commands i2c_read or i2c_write the client pointer
> passed to the respective function isn't completely initialized. This
> makes
>
> dev_dbg(&client->dev, ...);
>
> choke as it dereferences client->dev.driver->name with
> client->dev.driver being a random value.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/i2c/i2c.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> index fa2c0cd13697..e9e757558561 100644
> --- a/drivers/i2c/i2c.c
> +++ b/drivers/i2c/i2c.c
> @@ -184,7 +184,7 @@ int i2c_read_reg(struct i2c_client *client, u32 addr, u8 *buf, u16 count)
> msg->len = i;
>
> status = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
> - dev_dbg(&client->dev, "%s: %u@%u --> %d\n", __func__,
> + dev_dbg(&client->adapter->dev, "%s: %u@%u --> %d\n", __func__,
> count, addr, status);
>
> if (status == ARRAY_SIZE(msg))
> @@ -217,7 +217,7 @@ int i2c_write_reg(struct i2c_client *client, u32 addr, const u8 *buf, u16 count)
> memcpy(msg->buf + i, buf, count);
>
> status = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
> - dev_dbg(&client->dev, "%s: %u@%u --> %d\n", __func__,
> + dev_dbg(&client->adapter->dev, "%s: %u@%u --> %d\n", __func__,
> count, addr, status);
>
> if (status == ARRAY_SIZE(msg))
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2018-01-25 7:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 10:59 Uwe Kleine-König
2018-01-25 7:15 ` Sascha Hauer [this message]
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=20180125071513.3o27lvaxwtnmph64@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=u.kleine-koenig@pengutronix.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