[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191001164009.21610-1-alpawi@amazon.com>
Date: Tue, 1 Oct 2019 11:40:05 -0500
From: Patrick Williams <alpawi@...zon.com>
To: unlisted-recipients:; (no To-header on input)
CC: Björn Ardö <bjorn.ardo@...s.com>,
Patrick Williams <alpawi@...zon.com>,
Patrick Williams <patrick@...cx.xyz>,
Wolfram Sang <wsa@...-dreams.de>, <linux-i2c@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] i2c: slave-eeprom: initialize empty eeprom properly
The i2c-slave-eeprom driver emulates at24 class eeprom devices,
which come initialized with all 1s. Do the same in the software
emulation.
Signed-off-by: Patrick Williams <alpawi@...zon.com>
---
drivers/i2c/i2c-slave-eeprom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
index db9763cb4dae..efee56106251 100644
--- a/drivers/i2c/i2c-slave-eeprom.c
+++ b/drivers/i2c/i2c-slave-eeprom.c
@@ -131,6 +131,8 @@ static int i2c_slave_eeprom_probe(struct i2c_client *client, const struct i2c_de
if (!eeprom)
return -ENOMEM;
+ memset(eeprom->buffer, 0xFF, size);
+
eeprom->idx_write_cnt = 0;
eeprom->num_address_bytes = flag_addr16 ? 2 : 1;
eeprom->address_mask = size - 1;
--
2.17.2 (Apple Git-113)
Powered by blists - more mailing lists