Check all mmap() calls and print helpful Linux error message
Corresponding to flashrom svn r386 and coreboot v2 svn r3890.
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
diff --git a/chipset_enable.c b/chipset_enable.c
index 52d1549..d7eb7fa 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -220,6 +220,7 @@
if (spibar == MAP_FAILED) {
perror("Can't mmap memory using " MEM_DEV);
+ mmap_errmsg();
exit(1);
}
@@ -255,6 +256,7 @@
(off_t) tmp);
if (rcrb == MAP_FAILED) {
perror("Can't mmap memory using " MEM_DEV);
+ mmap_errmsg();
exit(1);
}
@@ -681,6 +683,7 @@
fd_mem, (off_t)tmp);
if (sb600_spibar == MAP_FAILED) {
perror("Can't mmap memory using " MEM_DEV);
+ mmap_errmsg();
exit(1);
}
sb600_spibar += low_bits;
@@ -837,6 +840,7 @@
if (mmcr == MAP_FAILED) {
perror("Can't mmap Elan SC520 specific registers using " MEM_DEV);
+ mmap_errmsg();
exit(1);
}