summaryrefslogtreecommitdiff
path: root/src/northbridge/intel
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-06-10 17:29:18 -0600
committerPatrick Georgi <pgeorgi@google.com>2019-07-10 10:15:26 +0000
commit64fb4a32e0b7e51f25f530d232fefc14c7523def (patch)
tree5f9505fd84934de752d4f9835b40186726367e88 /src/northbridge/intel
parentb3af349284c3fbe14ee55c48652fb46ddeb80484 (diff)
downloadcoreboot-64fb4a32e0b7e51f25f530d232fefc14c7523def.tar.xz
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>
Diffstat (limited to 'src/northbridge/intel')
-rw-r--r--src/northbridge/intel/nehalem/raminit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
index 2b71c81825..0b5f44c73f 100644
--- a/src/northbridge/intel/nehalem/raminit.c
+++ b/src/northbridge/intel/nehalem/raminit.c
@@ -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;
}