Allow upgrades of only one slot

When only upgrading one slot, the swap type for the non upgraded slot is
BOOT_SWAP_TYPE_FAIL instead of NONE.  Account for this, and check slot 0
in this case.

This is probably not the correct solution, but it is unclear of the
timing of when the dependencies of the other images first slot would be
checked.

Signed-off-by: David Brown <david.brown@linaro.org>
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index fc5b890..466ea8c 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -1831,10 +1831,12 @@
     struct image_version *dep_version;
     size_t dep_slot;
     int rc;
+    uint8_t swap_type;
 
     /* Determine the source of the image which is the subject of
      * the dependency and get it's version. */
-    dep_slot = (state->swap_type[dep->image_id] != BOOT_SWAP_TYPE_NONE) ?
+    swap_type = state->swap_type[dep->image_id];
+    dep_slot = (swap_type != BOOT_SWAP_TYPE_NONE && swap_type != BOOT_SWAP_TYPE_FAIL) ?
                 BOOT_SECONDARY_SLOT : BOOT_PRIMARY_SLOT;
     dep_version = &state->imgs[dep->image_id][dep_slot].hdr.ih_ver;