Commit 0bfaffbf authored by Florian Fainelli's avatar Florian Fainelli Committed by Konrad Rzeszutek Wilk

swiotlb: Group identical cleanup in swiotlb_cleanup()

Avoid repeating the zeroing of global swiotlb variables in two locations
and introduce swiotlb_cleanup() to do that.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 4e7372e0
...@@ -309,6 +309,14 @@ swiotlb_late_init_with_default_size(size_t default_size) ...@@ -309,6 +309,14 @@ swiotlb_late_init_with_default_size(size_t default_size)
return rc; return rc;
} }
static void swiotlb_cleanup(void)
{
io_tlb_end = 0;
io_tlb_start = 0;
io_tlb_nslabs = 0;
max_segment = 0;
}
int int
swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs)
{ {
...@@ -359,10 +367,7 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) ...@@ -359,10 +367,7 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs)
sizeof(int))); sizeof(int)));
io_tlb_list = NULL; io_tlb_list = NULL;
cleanup3: cleanup3:
io_tlb_end = 0; swiotlb_cleanup();
io_tlb_start = 0;
io_tlb_nslabs = 0;
max_segment = 0;
return -ENOMEM; return -ENOMEM;
} }
...@@ -386,10 +391,7 @@ void __init swiotlb_exit(void) ...@@ -386,10 +391,7 @@ void __init swiotlb_exit(void)
memblock_free_late(io_tlb_start, memblock_free_late(io_tlb_start,
PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
} }
io_tlb_start = 0; swiotlb_cleanup();
io_tlb_end = 0;
io_tlb_nslabs = 0;
max_segment = 0;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment