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>
This commit is contained in:
parent
644a512e56
commit
c19140b49f
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue