nb/intel/nehalem: Die if no memory ranks found

Die if there are no memory ranks found to prevent a division by zero.

Change-Id: I6146dd8420f3734d1a672a9f29a098f47fcb739c
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1229628
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33403
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Jacob Garber 2019-06-10 17:29:18 -06:00 committed by Patrick Georgi
parent b3af349284
commit 64fb4a32e0
1 changed files with 3 additions and 0 deletions

View File

@ -1010,6 +1010,9 @@ static void compute_derived_timings(struct raminfo *info)
}
}
if (count == 0)
die("No memory ranks found for channel %u\n", channel);
info->avg4044[channel] = sum / count;
info->max4048[channel] = max_of_unk;
}