summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorSeth Jennings <sjenning@linux.vnet.ibm.com>2012-06-13 16:03:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-13 17:21:46 -0700
commitb4b700c5a61c6e6db976f60d4eb6ad369e838aa9 (patch)
treef6c27e301028ad6d82ed56ef38dc6d587f5d2f01 /drivers/staging
parent03ae8189ee6cab3d4af3e39136105f02d7c35883 (diff)
downloadtalos-op-linux-b4b700c5a61c6e6db976f60d4eb6ad369e838aa9.tar.gz
talos-op-linux-b4b700c5a61c6e6db976f60d4eb6ad369e838aa9.zip
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/zsmalloc/zsmalloc-main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index fb54a9b94c33..4af3dd6641c9 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -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)
OpenPOWER on IntegriCloud