Skip to content

Commit

Permalink
staging: zsmalloc: fix uninit'ed variable warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Seth Jennings authored and Greg Kroah-Hartman committed Jun 14, 2012
1 parent 03ae818 commit b4b700c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/zsmalloc/zsmalloc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit b4b700c

Please sign in to comment.