Fix MISRA C issues in BL1/BL2/BL31

Attempts to address MISRA compliance issues in BL1, BL2, and BL31 code.
Mainly issues like not using boolean expressions in conditionals,
conflicting variable names, ignoring return values without (void), adding
explicit casts, etc.

Change-Id: If1fa18ab621b9c374db73fa6eaa6f6e5e55c146a
Signed-off-by: John Powell <john.powell@arm.com>
diff --git a/bl2/bl2_image_load_v2.c b/bl2/bl2_image_load_v2.c
index 81d4b2b..48c9bec 100644
--- a/bl2/bl2_image_load_v2.c
+++ b/bl2/bl2_image_load_v2.c
@@ -47,8 +47,9 @@
 		 * if indicated in the image attributes AND if NOT
 		 * already done before.
 		 */
-		if (bl2_node_info->image_info->h.attr & IMAGE_ATTRIB_PLAT_SETUP) {
-			if (plat_setup_done) {
+		if ((bl2_node_info->image_info->h.attr &
+		    IMAGE_ATTRIB_PLAT_SETUP) != 0U) {
+			if (plat_setup_done != 0) {
 				WARN("BL2: Platform setup already done!!\n");
 			} else {
 				INFO("BL2: Doing platform setup\n");
@@ -58,16 +59,17 @@
 		}
 
 		err = bl2_plat_handle_pre_image_load(bl2_node_info->image_id);
-		if (err) {
+		if (err != 0) {
 			ERROR("BL2: Failure in pre image load handling (%i)\n", err);
 			plat_error_handler(err);
 		}
 
-		if (!(bl2_node_info->image_info->h.attr & IMAGE_ATTRIB_SKIP_LOADING)) {
+		if ((bl2_node_info->image_info->h.attr &
+		    IMAGE_ATTRIB_SKIP_LOADING) == 0U) {
 			INFO("BL2: Loading image id %d\n", bl2_node_info->image_id);
 			err = load_auth_image(bl2_node_info->image_id,
 				bl2_node_info->image_info);
-			if (err) {
+			if (err != 0) {
 				ERROR("BL2: Failed to load image id %d (%i)\n",
 				      bl2_node_info->image_id, err);
 				plat_error_handler(err);
@@ -78,7 +80,7 @@
 
 		/* Allow platform to handle image information. */
 		err = bl2_plat_handle_post_image_load(bl2_node_info->image_id);
-		if (err) {
+		if (err != 0) {
 			ERROR("BL2: Failure in post image load handling (%i)\n", err);
 			plat_error_handler(err);
 		}