On Mon, Nov 07, 2005 at 04:57:27PM -0800, Matthew Dobson wrote:
> * Set 'res' at declaration instead of later in the function.
I hate to initialize a varible two miles away from the place where it's
used.
> --- linux-2.6.14+slab_cleanup.orig/mm/slab.c
> +++ linux-2.6.14+slab_cleanup/mm/slab.c
> @@ -3533,7 +3533,7 @@ ssize_t slabinfo_write(struct file *file
> size_t count, loff_t *ppos)
> {
> - int limit, batchcount, shared, res;
> + int limit, batchcount, shared, res = -EINVAL;
> /* Find the cache in the chain of caches. */
> down(&cache_chain_sem);
> - res = -EINVAL;
> list_for_each(p,&cache_chain) {
> kmem_cache_t *cachep = list_entry(p, kmem_cache_t, next);
> + if (strcmp(cachep->name, kbuf))
> + continue;
>
> - if (!strcmp(cachep->name, kbuf)) {
> - if (limit < 1 || batchcount < 1 ||
> - batchcount > limit || shared < 0) {
> - res = 0;
> - } else {
> - res = do_tune_cpucache(cachep, limit,
> - batchcount, shared);
> - }
> - break;
> - }
> + res = do_tune_cpucache(cachep, limit, batchcount, shared);
> + if (res >= 0)
> + res = count;
> + break;
> }
> up(&cache_chain_sem);
> - if (res >= 0)
> - res = count;
> return res;
> }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]