summaryrefslogtreecommitdiffstats
path: root/physmap.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-09-13 19:19:25 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-09-13 19:19:25 +0000
commita782c3ef48ffde52432aa0ac716a9a45adc83ac0 (patch)
treedf44af82a80c8b8d0ae86182f7fb51c0e8e7a94f /physmap.c
parent848ec393d7fdf627fd3f964c121e2ad329d3fc23 (diff)
downloadflashrom-a782c3ef48ffde52432aa0ac716a9a45adc83ac0.zip
flashrom-a782c3ef48ffde52432aa0ac716a9a45adc83ac0.tar.gz
Remove exit call from sys_physmap_*
All callers are prepared to handle error if ERROR_PTR is returned. The Manpage mentioning the respective return code is readapted. Binary file (standard input) matches Corresponding to flashrom svn r1744.
Diffstat (limited to 'physmap.c')
-rw-r--r--physmap.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/physmap.c b/physmap.c
index 9cac868..caad1ca 100644
--- a/physmap.c
+++ b/physmap.c
@@ -165,12 +165,11 @@ static void *sys_physmap_rw_uncached(uintptr_t phys_addr, size_t len)
/* Open the memory device UNCACHED. Important for MMIO. */
if (-1 == (fd_mem = open(MEM_DEV, O_RDWR | O_SYNC))) {
msg_perr("Critical error: open(" MEM_DEV "): %s\n", strerror(errno));
- exit(2);
+ return ERROR_PTR;
}
}
- virt_addr = mmap(NULL, len, PROT_WRITE | PROT_READ, MAP_SHARED,
- fd_mem, (off_t)phys_addr);
+ virt_addr = mmap(NULL, len, PROT_WRITE | PROT_READ, MAP_SHARED, fd_mem, (off_t)phys_addr);
return MAP_FAILED == virt_addr ? ERROR_PTR : virt_addr;
}
@@ -185,12 +184,11 @@ static void *sys_physmap_ro_cached(uintptr_t phys_addr, size_t len)
/* Open the memory device CACHED. */
if (-1 == (fd_mem_cached = open(MEM_DEV, O_RDWR))) {
msg_perr("Critical error: open(" MEM_DEV "): %s\n", strerror(errno));
- exit(2);
+ return ERROR_PTR;
}
}
- virt_addr = mmap(NULL, len, PROT_READ, MAP_SHARED,
- fd_mem_cached, (off_t)phys_addr);
+ virt_addr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd_mem_cached, (off_t)phys_addr);
return MAP_FAILED == virt_addr ? ERROR_PTR : virt_addr;
}
@@ -200,7 +198,7 @@ void physunmap(void *virt_addr, size_t len)
msg_pspew("Not unmapping zero size at %p\n", virt_addr);
return;
}
-
+
munmap(virt_addr, len);
}
#endif
OpenPOWER on IntegriCloud