]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xilinx: common: Fix MAC address read from EEPROM
authorPetr Zejdl <petr.zejdl@cern.ch>
Thu, 4 Apr 2024 11:44:22 +0000 (13:44 +0200)
committerMichal Simek <michal.simek@amd.com>
Wed, 10 Apr 2024 13:16:57 +0000 (15:16 +0200)
The upper-to-lowercase character conversion now avoids altering the
MAC address field. In the previous version, this alteration corrupted
the MAC address.

Signed-off-by: Petr Zejdl <petr.zejdl@cern.ch>
Link: https://lore.kernel.org/r/20240404114422.2905194-1-petr.zejdl@cern.ch
Signed-off-by: Michal Simek <michal.simek@amd.com>
board/xilinx/common/board.c

index f5117012d62c9ffe7c7337a365e45fa12bd56790..b47d2d23f913dbff20250e762947573c9ca20873 100644 (file)
@@ -105,10 +105,14 @@ static void xilinx_eeprom_legacy_cleanup(char *eeprom, int size)
        for (i = 0; i < size; i++) {
                byte = eeprom[i];
 
-               /* Remove all non printable chars but ignore MAC address */
-               if ((i < offsetof(struct xilinx_legacy_format, eth_mac) ||
-                    i >= offsetof(struct xilinx_legacy_format, unused1)) &&
-                    (byte < '!' || byte > '~')) {
+               /* Ignore MAC address */
+               if (i >= offsetof(struct xilinx_legacy_format, eth_mac) &&
+                   i < offsetof(struct xilinx_legacy_format, unused1)) {
+                       continue;
+               }
+
+               /* Remove all non printable chars */
+               if (byte < '!' || byte > '~') {
                        eeprom[i] = 0;
                        continue;
                }