diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-10-30 19:58:05 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-11-01 11:32:16 +0100 |
commit | 9e7d479d406e1bfb3e56dd4a14f6db8b6ee024b1 (patch) | |
tree | 5866bc14a1fe1c4ffb7f2b790288235fdc784568 /drivers/i2c | |
parent | bdf430340367e7b0d1a0bbfd749dc63821851d7f (diff) | |
download | barebox-9e7d479d406e1bfb3e56dd4a14f6db8b6ee024b1.tar.gz barebox-9e7d479d406e1bfb3e56dd4a14f6db8b6ee024b1.tar.xz |
ARM: i.MX: guf-santaro: fix passing around of uninitialized variable
i2c_device_present() does a zero byte read to probe for the i2c
device. Make i2c_write_reg handle a NULL buf to silence the compiler
warning.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175812.2276705-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c index 12aac42794..125322406a 100644 --- a/drivers/i2c/i2c.c +++ b/drivers/i2c/i2c.c @@ -215,7 +215,8 @@ int i2c_write_reg(struct i2c_client *client, u32 addr, const u8 *buf, u16 count) msgbuf[i++] = addr; msg->len += i; - memcpy(msg->buf + i, buf, count); + if (count) + memcpy(msg->buf + i, buf, count); status = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); dev_dbg(&client->adapter->dev, "%s: %u@%u --> %d\n", __func__, |