[coreboot-gerrit] Change in ...coreboot[master]: nb/amd/pi/00{630F01, 730F01}: Use ARRAY_SIZE

HAOUAS Elyes (Code Review) gerrit at coreboot.org
Tue Nov 27 11:27:02 CET 2018


HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/29860


Change subject: nb/amd/pi/00{630F01,730F01}: Use ARRAY_SIZE
......................................................................

nb/amd/pi/00{630F01,730F01}: Use ARRAY_SIZE

Use already defined ARRAY_SIZE macro.

Change-Id: Ie22e3557e958b562816921a985411dd55c712142
Signed-off-by: Elyes HAOUAS <ehaouas at noos.fr>
---
M src/northbridge/amd/pi/00630F01/dimmSpd.c
M src/northbridge/amd/pi/00730F01/dimmSpd.c
2 files changed, 6 insertions(+), 10 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/29860/1

diff --git a/src/northbridge/amd/pi/00630F01/dimmSpd.c b/src/northbridge/amd/pi/00630F01/dimmSpd.c
index 28e3fe4..dcf3192 100644
--- a/src/northbridge/amd/pi/00630F01/dimmSpd.c
+++ b/src/northbridge/amd/pi/00630F01/dimmSpd.c
@@ -23,8 +23,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 +32,11 @@
 	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
diff --git a/src/northbridge/amd/pi/00730F01/dimmSpd.c b/src/northbridge/amd/pi/00730F01/dimmSpd.c
index bbcbfe9..b7ffdb0 100644
--- a/src/northbridge/amd/pi/00730F01/dimmSpd.c
+++ b/src/northbridge/amd/pi/00730F01/dimmSpd.c
@@ -23,8 +23,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 +32,11 @@
 	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

-- 
To view, visit https://review.coreboot.org/c/coreboot/+/29860
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie22e3557e958b562816921a985411dd55c712142
Gerrit-Change-Number: 29860
Gerrit-PatchSet: 1
Gerrit-Owner: HAOUAS Elyes <ehaouas at noos.fr>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181127/13c86776/attachment-0001.html>


More information about the coreboot-gerrit mailing list