[U-Boot] "(ulong)&default_environment[0]" vs "(ulong)default_environment"?

Robert P. J. Day rpjday at crashcourse.ca
Wed Jul 6 13:43:35 CEST 2016


  more pedantry ... as i was crawling through the env code, i noticed
the common usage of "(ulong)&default_environment[0]" rather than what
i thought was the more standard expression
"(ulong)default_environment" to find the address of that array, so i
did a quick grep:

$ grep -r "gd->env_addr.*default_environment" *
board/freescale/ls1043ardb/ls1043ardb.c:	gd->env_addr = (ulong)&default_environment[0];
board/freescale/ls2080ardb/ls2080ardb.c:	gd->env_addr = (ulong)&default_environment[0];
board/freescale/ls2080a/ls2080a.c:	gd->env_addr = (ulong)&default_environment[0];
board/freescale/ls1043aqds/ls1043aqds.c:	gd->env_addr = (ulong)&default_environment[0];
board/freescale/ls2080aqds/ls2080aqds.c:	gd->env_addr = (ulong)&default_environment[0];
common/env_onenand.c:	gd->env_addr = (ulong)&default_environment[0];
common/env_sf.c:	gd->env_addr = (ulong)&default_environment[0];
common/env_dataflash.c:	gd->env_addr = (ulong)&default_environment[0];
common/env_nowhere.c:	gd->env_addr	= (ulong)&default_environment[0];
common/env_nvram.c:		gd->env_addr	= (ulong)&default_environment[0];
common/env_fat.c:	gd->env_addr = (ulong)&default_environment[0];
common/env_mmc.c:	gd->env_addr	= (ulong)&default_environment[0];
common/env_flash.c:	gd->env_addr	= (ulong)&default_environment[0];
common/env_remote.c:	gd->env_addr = (ulong)default_environment;            <-----
common/env_eeprom.c:	gd->env_addr = (ulong)&default_environment[0];
common/env_nand.c:	gd->env_addr	= (ulong)&default_environment[0];
common/env_ubi.c:	gd->env_addr = (ulong)&default_environment[0];
$

  so everyone seems to be using one form of that calculation, except
for that lonely expression in common/env_remote.c. :-( it all works,
of course, it's just inconsistent.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the U-Boot mailing list