diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2018-01-22 11:59:58 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-01-25 08:15:00 +0100 |
commit | dd95f5389989d69c46411d9325f7adfa043ee0a5 (patch) | |
tree | 145f16d0d2fed81c2e6091fc5264c5934de4f2a6 /drivers/i2c | |
parent | 38984530b741b1421815e432f92e49f33564ec4a (diff) | |
download | barebox-dd95f5389989d69c46411d9325f7adfa043ee0a5.tar.gz barebox-dd95f5389989d69c46411d9325f7adfa043ee0a5.tar.xz |
i2c: read/write_reg: don't assume client->dev to be valid
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c index fa2c0cd136..e9e7575585 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)) |