diff mbox series

mm/sparse: Add the missing sparse_buffer_fini() in error branch

Message ID 20210326022325.3181-1-wangwensheng4@huawei.com (mailing list archive)
State New, archived
Headers show
Series mm/sparse: Add the missing sparse_buffer_fini() in error branch | expand

Commit Message

Wang Wensheng March 26, 2021, 2:23 a.m. UTC
sparse_buffer_init() and sparse_buffer_fini() should appear in pair, or
a WARN issue would be through the next time sparse_buffer_init() runs.

Add the missing sparse_buffer_fini() in error branch.

Fixes: 85c77f791390 ("mm/sparse: add new sparse_init_nid() and sparse_init()")
Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
---
 mm/sparse.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Hildenbrand March 26, 2021, 9:11 a.m. UTC | #1
On 26.03.21 03:23, Wang Wensheng wrote:
> sparse_buffer_init() and sparse_buffer_fini() should appear in pair, or
> a WARN issue would be through the next time sparse_buffer_init() runs.
> 
> Add the missing sparse_buffer_fini() in error branch.
> 
> Fixes: 85c77f791390 ("mm/sparse: add new sparse_init_nid() and sparse_init()")
> Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
> ---
>   mm/sparse.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 7bd23f9..33406ea 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -547,6 +547,7 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,
>   			pr_err("%s: node[%d] memory map backing failed. Some memory will not be available.",
>   			       __func__, nid);
>   			pnum_begin = pnum;
> +			sparse_buffer_fini();
>   			goto failed;
>   		}
>   		check_usemap_section_nr(nid, usage);
> 

I am confused, why the resend, and why without RBs?

https://lkml.kernel.org/r/20210325113155.118574-1-wangwensheng4@huawei.com
diff mbox series

Patch

diff --git a/mm/sparse.c b/mm/sparse.c
index 7bd23f9..33406ea 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -547,6 +547,7 @@  static void __init sparse_init_nid(int nid, unsigned long pnum_begin,
 			pr_err("%s: node[%d] memory map backing failed. Some memory will not be available.",
 			       __func__, nid);
 			pnum_begin = pnum;
+			sparse_buffer_fini();
 			goto failed;
 		}
 		check_usemap_section_nr(nid, usage);