fmaptool: Conform to cbfstool's error message format

The tool now makes use of the ERROR() macros from common.h.

Change-Id: Ie38f40c65f7b6d3bc2adb97e246224cd38d4cb99
Signed-off-by: Sol Boucher <solb@chromium.org>
Reviewed-on: http://review.coreboot.org/10048
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/util/cbfstool/fmd.c b/util/cbfstool/fmd.c
index bfce049..a4430be 100644
--- a/util/cbfstool/fmd.c
+++ b/util/cbfstool/fmd.c
@@ -19,6 +19,7 @@
 
 #include "fmd.h"
 
+#include "common.h"
 #include "fmd_parser.h"
 #include "fmd_scanner.h"
 #include "option.h"
@@ -56,8 +57,7 @@
 
 	ENTRY search_key = {node->name, NULL};
 	if (hsearch(search_key, FIND)) {
-		fprintf(stderr, "ERROR: Multiple sections with name '%s'\n",
-								node->name);
+		ERROR("Multiple sections with name '%s'\n", node->name);
 		return false;
 	}
 	if (!hsearch(search_key, ENTER))
@@ -65,26 +65,22 @@
 
 	if (node->offset_known) {
 		if (start.val_known && node->offset < start.val) {
-			fprintf(stderr, "ERROR: Section '%s' starts too low\n",
-								node->name);
+			ERROR("Section '%s' starts too low\n", node->name);
 			return false;
 		} else if (end.val_known && node->offset > end.val) {
-			fprintf(stderr, "ERROR: Section '%s' starts too high\n",
-								node->name);
+			ERROR("Section '%s' starts too high\n", node->name);
 			return false;
 		}
 	}
 
 	if (node->size_known) {
 		if (node->size == 0) {
-			fprintf(stderr, "ERROR: Section '%s' given no space\n",
-								node->name);
+			ERROR("Section '%s' given no space\n", node->name);
 			return false;
 		} else if (node->offset_known) {
 			unsigned node_end = node->offset + node->size;
 			if (end.val_known && node_end > end.val) {
-				fprintf(stderr, "ERROR: Section '%s' too big\n",
-								node->name);
+				ERROR("Section '%s' too big\n", node->name);
 				return false;
 			}
 		}
@@ -120,16 +116,14 @@
 		assert(cur->offset_known || cur->size_known);
 		if (!cur->offset_known) {
 			if (cur->size > end_watermark) {
-				fprintf(stderr, "ERROR: Section '%s' too big\n",
-								cur->name);
+				ERROR("Section '%s' too big\n", cur->name);
 				return false;
 			}
 			cur->offset_known = true;
 			cur->offset = end_watermark -= cur->size;
 		} else if (!cur->size_known) {
 			if (cur->offset > end_watermark) {
-				fprintf(stderr,
-					"ERROR: Section '%s' starts too high\n",
+				ERROR("Section '%s' starts too high\n",
 								cur->name);
 				return false;
 			}
@@ -230,8 +224,7 @@
 
 		if (!cur_section->size_known) {
 			if (!cur_section->offset_known) {
-				fprintf(stderr,
-					"ERROR: Cannot determine either offset or size of section '%s'\n",
+				ERROR("Cannot determine either offset or size of section '%s'\n",
 							cur_section->name);
 				return false;
 			} else if (!first_incomplete_it) {
@@ -315,7 +308,7 @@
 		// This hash table is used to store the declared name of each
 		// section and ensure that each is globally unique.
 		if (!hcreate(fmd_count_nodes(ret))) {
-			perror("ERROR: While initializing hashtable");
+			perror("E: While initializing hashtable");
 			fmd_cleanup(ret);
 			return NULL;
 		}