From: Tobias Klauser Date: Sun, 8 Jan 2006 09:00:59 +0000 (-0800) Subject: [PATCH] mm: clean up local variables X-Git-Tag: v2.6.16-rc1~881 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=cd105df4590c89837a1c300843238148cfef9b5f;p=powerpc.git [PATCH] mm: clean up local variables Clean up a local variable with the same name as a variable in a larger block. Also move a variable into the block where it's actually used. Spotted by http://linuxicc.sourceforge.net/ Signed-off-by: Tobias Klauser Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slab.c b/mm/slab.c index f71d8be2f4..76b092bd0b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -854,7 +854,6 @@ static int __devinit cpuup_callback(struct notifier_block *nfb, struct kmem_list3 *l3 = NULL; int node = cpu_to_node(cpu); int memsize = sizeof(struct kmem_list3); - struct array_cache *nc = NULL; switch (action) { case CPU_UP_PREPARE: @@ -891,6 +890,8 @@ static int __devinit cpuup_callback(struct notifier_block *nfb, /* Now we can go ahead with allocating the shared array's & array cache's */ list_for_each_entry(cachep, &cache_chain, next) { + struct array_cache *nc; + nc = alloc_arraycache(node, cachep->limit, cachep->batchcount); if (!nc) diff --git a/mm/swapfile.c b/mm/swapfile.c index 6da4b28b89..80f948a202 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1493,7 +1493,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) goto bad_swap; if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES) goto bad_swap; - + /* OK, set up the swap map and apply the bad block list */ if (!(p->swap_map = vmalloc(maxpages * sizeof(short)))) { error = -ENOMEM; @@ -1502,17 +1502,17 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) error = 0; memset(p->swap_map, 0, maxpages * sizeof(short)); - for (i=0; iinfo.nr_badpages; i++) { - int page = swap_header->info.badpages[i]; - if (page <= 0 || page >= swap_header->info.last_page) + for (i = 0; i < swap_header->info.nr_badpages; i++) { + int page_nr = swap_header->info.badpages[i]; + if (page_nr <= 0 || page_nr >= swap_header->info.last_page) error = -EINVAL; else - p->swap_map[page] = SWAP_MAP_BAD; + p->swap_map[page_nr] = SWAP_MAP_BAD; } nr_good_pages = swap_header->info.last_page - swap_header->info.nr_badpages - 1 /* header page */; - if (error) + if (error) goto bad_swap; }