diff options
author | Rob Barnes <robbarnes@google.com> | 2020-08-14 15:25:33 -0600 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2020-08-27 22:39:32 +0000 |
commit | c19140b49f1972cb3b0be5467a4c8a735226bb90 (patch) | |
tree | 9e7245b27894b8076e02f8af73d16dedd0cfae30 /util/spd_tools | |
parent | 644a512e560147324ecf74ebce5e336bc57dd7bf (diff) |
util: Add check for duplicate entries in mem parts json
Check for duplicate entries in mem parts json file.
BUG=b:162939176
TEST=Verified that tool throws error when there is a duplicate.
Signed-off-by: Rob Barnes <robbarnes@google.com>
Change-Id: I7c638c7938958727cfc832e7b4556acbc04b0ca4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44478
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/spd_tools')
-rw-r--r-- | util/spd_tools/ddr4/gen_spd.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/spd_tools/ddr4/gen_spd.go b/util/spd_tools/ddr4/gen_spd.go index 831cddf824..e99239acd2 100644 --- a/util/spd_tools/ddr4/gen_spd.go +++ b/util/spd_tools/ddr4/gen_spd.go @@ -1068,7 +1068,14 @@ func verifySupportedCASLatencies(part *memPart) error { } func validateMemoryParts(memParts *memParts) error { + memPartExists := make(map[string]bool) + for i := 0; i < len(memParts.MemParts); i++ { + if memPartExists[memParts.MemParts[i].Name] { + return fmt.Errorf(memParts.MemParts[i].Name + " is duplicated in mem_parts_list_json") + } + memPartExists[memParts.MemParts[i].Name] = true + if err := validateSpeedMTps(memParts.MemParts[i].Attribs.SpeedMTps); err != nil { return err } |