riscv: linux: vout: fix rgb2hdmi display problem
[platform/kernel/linux-starfive.git] / mm / memblock.c
index 5c3503c..5096500 100644 (file)
@@ -932,16 +932,14 @@ int __init_memblock memblock_mark_mirror(phys_addr_t base, phys_addr_t size)
  * covered by the memory map. The struct page representing NOMAP memory
  * frames in the memory map will be PageReserved()
  *
+ * Note: if the memory being marked %MEMBLOCK_NOMAP was allocated from
+ * memblock, the caller must inform kmemleak to ignore that memory
+ *
  * Return: 0 on success, -errno on failure.
  */
 int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size)
 {
-       int ret = memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP);
-
-       if (!ret)
-               kmemleak_free_part_phys(base, size);
-
-       return ret;
+       return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP);
 }
 
 /**
@@ -1692,7 +1690,7 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size)
        if (!size)
                return;
 
-       if (memblock.memory.cnt <= 1) {
+       if (!memblock_memory->total_size) {
                pr_warn("%s: No memory registered yet\n", __func__);
                return;
        }