platform: msm_shared: avb: Support recovery as chain

Correct the loading of image based on image size
to be loaded.As LK loads images based on the
partition name, so in case when recovery as chain
is enabled we only need to read the footer.

Change-Id: Icea7d4fb627fb305904d3a240edd0ad34792afc8
diff --git a/platform/msm_shared/avb/libavb/avb_ops.c b/platform/msm_shared/avb/libavb/avb_ops.c
index 8600eb3..11f428a 100644
--- a/platform/msm_shared/avb/libavb/avb_ops.c
+++ b/platform/msm_shared/avb/libavb/avb_ops.c
@@ -57,6 +57,7 @@
 #include <err.h>
 #include <ab_partition_parser.h>
 #include <partition_parser.h>
+#define MAX_FOOTER_SIZE 4096
 
 struct partition_entry *PtnEntries;
 
@@ -177,7 +178,7 @@
 	}
 	*OutNumRead = 0;
 
-	if (!getimage(Buffer, OutNumRead, Partition)) {
+	if (NumBytes > MAX_FOOTER_SIZE && !getimage(Buffer, OutNumRead, Partition)) {
 		/* API returns previously loaded Images buffer address and size */
                 dprintf(SPEW, "DEBUG: %s already loaded \n", Partition);
 		return AVB_IO_RESULT_OK;