missing clear bdr in check_ram_in_range_map()?

From: Baochen Qiang
Date: Mon Dec 09 2024 - 05:51:27 EST


Hi,

while checking check_ram_in_range_map() I am confused by the condition set/check on bdr.
If I am reading the code correctly, if bdr is set once, it would never get cleared, hence
that function will always returns 0.

should we clear bdr before each new iteration?

diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 5b4e6d3bf7bc..1605b956b25e 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -611,6 +611,7 @@ static int check_ram_in_range_map(unsigned long start_pfn,
return 1;

start_pfn = PFN_DOWN(bdr->cpu_start) + PFN_DOWN(bdr->size);
+ bdr = NULL;
}

return 0;