Skip to content

Commit

Permalink
uboot: fix tlv eeprom access to second eeprom (not used)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josua-SR committed Nov 20, 2024
1 parent 69642e2 commit 4bbc369
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 413ad975194c929a09199e6a67cf3d2b2f0fb337 Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Wed, 20 Nov 2024 13:43:02 +0100
Subject: [PATCH] cmd: tlv_eeprom: fix alias access to second eeprom

find function wrongly used ARRAY_SIZE function on a 2d pointer, always
returning 1. Thus second eeprom can not be found.

Replace with defined constant MAX_TLV_DEVICES.

Fixes: "cmd: tlv_eeprom: support specifying tlv eeprom in DT alias tlv[0-255]"
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
cmd/tlv_eeprom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index 546ede2dda2..881d7a8e3e6 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -906,7 +906,7 @@ static int find_tlv_devices(struct udevice **tlv_devices_p)
struct udevice *dev;

/* find by alias */
- for (int i = 0; i < ARRAY_SIZE(tlv_devices_p); i++) {
+ for (int i = 0; i < MAX_TLV_DEVICES; i++) {
snprintf(alias_name, sizeof(alias_name), "tlv%d", i);
node = ofnode_get_aliases_node(alias_name);
if (!ofnode_valid(node))
--
2.43.0

0 comments on commit 4bbc369

Please sign in to comment.