cmd: bdinfo: Fix showing correct IP address based on current device

Use the same logic as is used for MAC address where bdi shows mac address
for current device where index (idx) is used to point to correct IP address
which is read and show.

Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
Michal Simek 2025-07-29 09:12:54 +02:00 committed by Tom Rini
parent c03d7a4801
commit fcac9bfbbd

View File

@ -46,6 +46,7 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value)
static void print_eth(void)
{
const int idx = eth_get_dev_index();
char ipstr[] = "ipaddr\0\0";
uchar enetaddr[6];
char name[10];
int ret;
@ -62,7 +63,11 @@ static void print_eth(void)
printf("%-12s= (not set)\n", name);
else
printf("%-12s= %pM\n", name, enetaddr);
printf("IP addr = %s\n", env_get("ipaddr"));
if (idx > 0)
sprintf(ipstr, "ipaddr%d", idx);
printf("IP addr = %s\n", env_get(ipstr));
}
void bdinfo_print_mhz(const char *name, unsigned long hz)