MA-11226 [Android] Set active slot fail after flashing bootloader
authorLuo Ji <ji.luo@nxp.com>
Wed, 24 Jan 2018 11:01:24 +0000 (19:01 +0800)
committerLuo Ji <ji.luo@nxp.com>
Wed, 24 Jan 2018 11:28:41 +0000 (19:28 +0800)
Flash bootloader will switch the mmc hwpart to boot0 partition which
will cause errors when read/write blocks from user partition. Fix
this bug by switching hwpart to user partition before read/write
user partition every time.

Change-Id: I5e3405de04e22db352efa59f0286e5c5c4697ac5
Signed-off-by: Luo Ji <ji.luo@nxp.com>
lib/avb/fsl/fsl_avb.c

index 59c7c0a..567780d 100644 (file)
@@ -62,7 +62,7 @@ static struct blk_desc *get_mmc_desc(void) {
 
        assert(buffer != NULL && out_num_read != NULL);
 
-       if (!fs_dev_desc && (fs_dev_desc = get_mmc_desc()) == NULL) {
+       if ((fs_dev_desc = get_mmc_desc()) == NULL) {
                ERR("mmc device not found\n");
                return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
        }
@@ -145,7 +145,7 @@ fail:
 
        assert(buffer != NULL && out_num_read != NULL);
 
-       if (!fs_dev_desc && (fs_dev_desc = get_mmc_desc()) == NULL) {
+       if ((fs_dev_desc = get_mmc_desc()) == NULL) {
                ERR("mmc device not found\n");
                return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
        }
@@ -268,7 +268,7 @@ fail:
 
        assert(buffer != NULL);
 
-       if (!fs_dev_desc && (fs_dev_desc = get_mmc_desc()) == NULL) {
+       if ((fs_dev_desc = get_mmc_desc()) == NULL) {
                ERR("mmc device not found\n");
                return AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION;
        }