boot: Fix false error condition in direct-xip mode

A false error condition occurs from v1.7.0 when all the optional
features are disabled in direct-xip mode.

Change-Id: I1e5f5e87f4f393c276372ae98947bd80c22fc163
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index b81a7ce..30cb943 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2016-2020 Linaro LTD
  * Copyright (c) 2016-2019 JUUL Labs
- * Copyright (c) 2019-2020 Arm Limited
+ * Copyright (c) 2019-2021 Arm Limited
  *
  * Original license:
  *
@@ -2322,6 +2322,15 @@
                              * version.
                              */
                             continue;
+                        } else {
+                            /* An image with a greater version number has
+                             * been found.
+                             * Sanitize the 'rc' variable to prevent the
+                             * occurrence of a false error condition (its value
+                             * may not be overwritten until the end of the
+                             * function).
+                             */
+                            rc = 0;
                         }
                     }
                     selected_slot = slot;