]> git.dujemihanovic.xyz Git - u-boot.git/commit
misc: i2c_eeprom: consider pagesize when writing to eeprom
authorMichel Alex <Alex.Michel@wiedemann-group.com>
Thu, 26 Oct 2023 05:47:41 +0000 (05:47 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 30 Oct 2023 19:32:49 +0000 (15:32 -0400)
commit5ed1c55fb4c23dc9f14b9c8d1d687f8c0ee703ac
treeba75e840777ea0213e0c97fb72234d1ea4ed7769
parent9f339140047041d867b9cccfb67afcb87eb848bf
misc: i2c_eeprom: consider pagesize when writing to eeprom

Calculate the maximum length of the buffer when writing
across the page boundary. If the buffer length (len)
exceeds the page boundary (pagesize), split it. Use this
length instead of comparing the length with the pagesize,
because if the write start address (offset) is not at the
beginning of a page and the page_offset + len is greater
than the page boundary (pagesize), the write operation
would overflow the current page and the behaviour can be
undefined (e.g. at24).

Signed-off-by: Alex Michel <alex.michel@wiedemann-group.com>
drivers/misc/i2c_eeprom.c