plat/arm/arm_image_load: fix bug of overriding the last node

The traverse flow in function plat_add_sp_images_load_info() will find
the last node in the main load info list, with its
next_load_info==NULL. However this node is still useful and should not
be overridden with SP node info.

The bug will cause below error on RDN2 for spmd enabled:

ERROR:   Invalid NT_FW_CONFIG DTB passed

Fix the bug by only setting the next_load_info of the last node in the
original main node list.

Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com>
Change-Id: Icaee5da1f2d53b29fdd6085a8cc507446186fd57
diff --git a/plat/arm/common/arm_image_load.c b/plat/arm/common/arm_image_load.c
index ed7f1f5..11cb3b8 100644
--- a/plat/arm/common/arm_image_load.c
+++ b/plat/arm/common/arm_image_load.c
@@ -51,10 +51,15 @@
 		node_info = node_info->next_load_info;
 	} while (node_info->next_load_info != NULL);
 
+	bl_load_info_node_t *sp_node =
+		&sp_mem_params_descs[index].load_node_mem;
+
+	node_info->next_load_info = sp_node;
+
 	for (; index < MAX_SP_IDS; index++) {
 		/* Populate the image information */
-		node_info->image_id = sp_mem_params_descs[index].image_id;
-		node_info->image_info = &sp_mem_params_descs[index].image_info;
+		sp_node->image_id = sp_mem_params_descs[index].image_id;
+		sp_node->image_info = &sp_mem_params_descs[index].image_info;
 
 		if ((index + 1U) == MAX_SP_IDS) {
 			INFO("Reached Max number of SPs\n");
@@ -65,9 +70,9 @@
 			return;
 		}
 
-		node_info->next_load_info =
+		sp_node->next_load_info =
 			&sp_mem_params_descs[index + 1U].load_node_mem;
-		node_info = node_info->next_load_info;
+		sp_node = sp_node->next_load_info;
 
 	}
 }