mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 17:33:01 +00:00
staging: zsmalloc: fix uninit'ed variable warning
This patch fixes an uninitialized variable warning in alloc_zspage(). It also fixes the secondary issue of prev_page leaving scope on each loop iteration. The only reason this ever worked was because prev_page was occupying the same space on the stack on each iteration. Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
03ae8189ee
commit
b4b700c5a6
@ -400,7 +400,7 @@ static void init_zspage(struct page *first_page, struct size_class *class)
|
||||
static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
|
||||
{
|
||||
int i, error;
|
||||
struct page *first_page = NULL;
|
||||
struct page *first_page = NULL, *uninitialized_var(prev_page);
|
||||
|
||||
/*
|
||||
* Allocate individual pages and link them together as:
|
||||
@ -415,7 +415,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
|
||||
*/
|
||||
error = -ENOMEM;
|
||||
for (i = 0; i < class->pages_per_zspage; i++) {
|
||||
struct page *page, *prev_page;
|
||||
struct page *page;
|
||||
|
||||
page = alloc_page(flags);
|
||||
if (!page)
|
||||
|
Loading…
Reference in New Issue
Block a user