nb/amd/pi/00{630F01,730F01}: Use ARRAY_SIZE
Use already defined ARRAY_SIZE macro. Change-Id: Ie22e3557e958b562816921a985411dd55c712142 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/29860 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
66b462dd4f
commit
0afc41e865
|
@ -13,6 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <commonlib/helpers.h>
|
||||
#include <device/pci_def.h>
|
||||
#include <device/device.h>
|
||||
|
||||
|
@ -23,8 +24,6 @@
|
|||
|
||||
#include <northbridge/amd/pi/dimmSpd.h>
|
||||
|
||||
#define DIMENSION(array)(sizeof(array)/ sizeof(array [0]))
|
||||
|
||||
AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info)
|
||||
{
|
||||
int spdAddress;
|
||||
|
@ -34,11 +33,11 @@ AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PAR
|
|||
if ((dev == 0) || (config == 0))
|
||||
return AGESA_ERROR;
|
||||
|
||||
if (info->SocketId >= DIMENSION(config->spdAddrLookup ))
|
||||
if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup))
|
||||
return AGESA_ERROR;
|
||||
if (info->MemChannelId >= DIMENSION(config->spdAddrLookup[0] ))
|
||||
if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0]))
|
||||
return AGESA_ERROR;
|
||||
if (info->DimmId >= DIMENSION(config->spdAddrLookup[0][0]))
|
||||
if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0]))
|
||||
return AGESA_ERROR;
|
||||
|
||||
spdAddress = config->spdAddrLookup
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <commonlib/helpers.h>
|
||||
#include <device/pci_def.h>
|
||||
#include <device/device.h>
|
||||
|
||||
|
@ -23,8 +24,6 @@
|
|||
|
||||
#include <northbridge/amd/pi/dimmSpd.h>
|
||||
|
||||
#define DIMENSION(array)(sizeof(array)/ sizeof(array [0]))
|
||||
|
||||
AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info)
|
||||
{
|
||||
int spdAddress;
|
||||
|
@ -34,11 +33,11 @@ AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PAR
|
|||
if ((dev == 0) || (config == 0))
|
||||
return AGESA_ERROR;
|
||||
|
||||
if (info->SocketId >= DIMENSION(config->spdAddrLookup ))
|
||||
if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup))
|
||||
return AGESA_ERROR;
|
||||
if (info->MemChannelId >= DIMENSION(config->spdAddrLookup[0] ))
|
||||
if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0]))
|
||||
return AGESA_ERROR;
|
||||
if (info->DimmId >= DIMENSION(config->spdAddrLookup[0][0]))
|
||||
if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0]))
|
||||
return AGESA_ERROR;
|
||||
|
||||
spdAddress = config->spdAddrLookup
|
||||
|
|
Loading…
Reference in New Issue