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>
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
index 2b71c81..0b5f44c 100644
--- a/src/northbridge/intel/nehalem/raminit.c
+++ b/src/northbridge/intel/nehalem/raminit.c
@@ -1010,6 +1010,9 @@
 			}
 		}
 
+		if (count == 0)
+			die("No memory ranks found for channel %u\n", channel);
+
 		info->avg4044[channel] = sum / count;
 		info->max4048[channel] = max_of_unk;
 	}