From 9df731a176aab8e03b984b681b1bea01ccff6644 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 06 Nov 2023 07:23:06 +0000
Subject: [PATCH] rk3568 rt uboot init

---
 u-boot/lib/avb/libavb/avb_slot_verify.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/u-boot/lib/avb/libavb/avb_slot_verify.c b/u-boot/lib/avb/libavb/avb_slot_verify.c
index af556e5..be3ff38 100644
--- a/u-boot/lib/avb/libavb/avb_slot_verify.c
+++ b/u-boot/lib/avb/libavb/avb_slot_verify.c
@@ -22,7 +22,7 @@
  * SOFTWARE.
  */
 #include <common.h>
-#include <sysmem.h>
+#include <android_image.h>
 #include <android_avb/avb_slot_verify.h>
 #include <android_avb/avb_chain_partition_descriptor.h>
 #include <android_avb/avb_cmdline.h>
@@ -30,6 +30,7 @@
 #include <android_avb/avb_hash_descriptor.h>
 #include <android_avb/avb_hashtree_descriptor.h>
 #include <android_avb/avb_kernel_cmdline_descriptor.h>
+#include <android_avb/avb_ops_user.h>
 #include <android_avb/avb_sha.h>
 #include <android_avb/avb_util.h>
 #include <android_avb/avb_vbmeta_image.h>
@@ -118,7 +119,7 @@
 
   /* Allocate and copy the partition. */
   if (!*out_image_preloaded) {
-    *out_image_buf = sysmem_alloc(MEM_AVB_ANDROID, image_size);
+    *out_image_buf = avb_malloc(image_size);
     if (*out_image_buf == NULL) {
       return AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
     }
@@ -296,7 +297,7 @@
   bool image_preloaded = false;
   uint8_t* digest;
   size_t digest_len;
-  const char* found;
+  const char* found = NULL;
   uint64_t image_size;
   size_t expected_digest_len = 0;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];
@@ -388,7 +389,7 @@
       allow_verification_error);
   if (ret != AVB_SLOT_VERIFY_RESULT_OK) {
     goto out;
-  } else if (image_preloaded) {
+  } else if (allow_verification_error) {
     goto out;
   }
 
@@ -482,7 +483,7 @@
 
 fail:
   if (image_buf != NULL && !image_preloaded) {
-    sysmem_free((phys_addr_t)image_buf);
+    avb_free(image_buf);
   }
   return ret;
 }
@@ -556,7 +557,7 @@
 out:
   /* Free the current buffer if any. */
   if (image_buf != NULL && !image_preloaded) {
-    sysmem_free((phys_addr_t)image_buf);
+    avb_free(image_buf);
   }
   /* Buffers that are already saved in slot_data will be handled by the caller
    * even on failure. */
@@ -1662,7 +1663,7 @@
         avb_free(loaded_partition->partition_name);
       }
       if (loaded_partition->data != NULL && !loaded_partition->preloaded) {
-        sysmem_free((phys_addr_t)loaded_partition->data);
+        avb_free(loaded_partition->data);
       }
     }
     avb_free(data->loaded_partitions);

--
Gitblit v1.6.2