northbridge/amd/amdfam10: Remove array to null comparison

The address of array 'sysinfo->DCTstatA' will always evaluate to 'true'.
Remove checking the base pointer of an array for validity.

Found-by: Coverity (CID 1293135: Incorrect expression)
Found-by: Clang (Wpointer-bool-conversion)

Change-Id: I99c9c9f1564dfb997c60b2a895d664e3b06c117b
Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Reviewed-on: http://review.coreboot.org/9596
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Timothy Pearson 2015-04-12 14:11:27 -05:00 committed by Stefan Reinauer
parent 0004ae8f4b
commit 46b2271ea4
1 changed files with 27 additions and 28 deletions

View File

@ -207,12 +207,13 @@ static void raminit_amdmct(struct sys_info *sysinfo)
static void amdmct_cbmem_store_info(struct sys_info *sysinfo) static void amdmct_cbmem_store_info(struct sys_info *sysinfo)
{ {
if (!sysinfo)
return;
/* Save memory info structures for use in ramstage */ /* Save memory info structures for use in ramstage */
size_t i; size_t i;
struct MCTStatStruc *pMCTstat = &(sysinfo->MCTstat);
struct DCTStatStruc *pDCTstatA = NULL; struct DCTStatStruc *pDCTstatA = NULL;
if (pMCTstat && sysinfo->DCTstatA) {
/* Allocate memory */ /* Allocate memory */
struct amdmct_memory_info* mem_info; struct amdmct_memory_info* mem_info;
mem_info = cbmem_add(CBMEM_ID_AMDMCT_MEMINFO, sizeof(struct amdmct_memory_info)); mem_info = cbmem_add(CBMEM_ID_AMDMCT_MEMINFO, sizeof(struct amdmct_memory_info));
@ -235,12 +236,10 @@ static void amdmct_cbmem_store_info(struct sys_info *sysinfo)
/* Zero out invalid/unused pointers */ /* Zero out invalid/unused pointers */
#if IS_ENABLED(CONFIG_DIMM_DDR3) #if IS_ENABLED(CONFIG_DIMM_DDR3)
for (i = 0; i < MAX_NODES_SUPPORTED; i++) { for (i = 0; i < MAX_NODES_SUPPORTED; i++) {
mem_info->dct_stat[i].C_MCTPtr = NULL; mem_info->dct_stat[i].C_MCTPtr = NULL;
mem_info->dct_stat[i].C_DCTPtr[0] = NULL; mem_info->dct_stat[i].C_DCTPtr[0] = NULL;
mem_info->dct_stat[i].C_DCTPtr[1] = NULL; mem_info->dct_stat[i].C_DCTPtr[1] = NULL;
} }
#endif #endif
}
} }