More error checking when trying to open files in
cbfstool. (trivial)

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4634 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 8db2d8cf..9227337 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -31,6 +31,8 @@
 	       int place)
 {
 	FILE *file = fopen(filename, "rb");
+	if (file == NULL)
+		return NULL;
 	fseek(file, 0, SEEK_END);
 	*romsize_p = ftell(file);
 	fseek(file, 0, SEEK_SET);
@@ -65,6 +67,8 @@
 void *loadrom(const char *filename)
 {
 	void *romarea = loadfile(filename, &romsize, 0, SEEK_SET);
+	if (romarea == NULL)
+		return NULL;
 	recalculate_rom_geometry(romarea);
 	return romarea;
 }