[PATCH 5/7] scripts: kwboot: simplify kwboot_mmap_image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There was only a single caller who passes prot=PROT_READ unconditionally.
So drop this parameter and simplify accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 scripts/kwboot.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 58ea1ad7a7b3..1fcb49b7acda 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -657,9 +657,9 @@ kwboot_check_image(const unsigned char *img, size_t size)
 }
 
 static void *
-kwboot_mmap_image(const char *path, size_t *size, int prot)
+kwboot_mmap_image(const char *path, size_t *size)
 {
-	int rc, fd, flags;
+	int rc, fd;
 	struct stat st;
 	void *img;
 
@@ -674,9 +674,7 @@ kwboot_mmap_image(const char *path, size_t *size, int prot)
 	if (rc)
 		goto out;
 
-	flags = (prot & PROT_WRITE) ? MAP_PRIVATE : MAP_SHARED;
-
-	img = mmap(NULL, st.st_size, prot, flags, fd, 0);
+	img = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
 	if (img == MAP_FAILED) {
 		img = NULL;
 		goto out;
@@ -793,7 +791,7 @@ main(int argc, char **argv)
 	}
 
 	if (imgpath) {
-		img = kwboot_mmap_image(imgpath, &size, PROT_READ);
+		img = kwboot_mmap_image(imgpath, &size);
 		if (!img) {
 			perror(imgpath);
 			goto out;
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux