Re: [PATCH] cpuset: sparse warnings in cpuset.c

Harvey Harrison
2008-02-03T07:42:25Z

Don't redeclare p, use a new variable q.

kernel/cpuset.c:824:23: warning: symbol 'p' shadows an earlier one
kernel/cpuset.c:746:21: originally declared here
kernel/cpuset.c:1272:52: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Paul, used a variable q instead as per your request.

kernel/cpuset.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index cfaf641..ce0cfff 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -821,13 +821,13 @@ static int update_cpumask(struct cpuset *cs, char *buf)
cgroup_iter_end(cgrp, &it);
if (heap.size) {
for (i = 0; i < heap.size; i++) {
- struct task_struct *p = heap.ptrs[i];
+ struct task_struct *q = heap.ptrs[i];
if (i == 0) {
- latest_time = p->start_time;
- latest_task = p;
+ latest_time = q->start_time;
+ latest_task = q;
}
- set_cpus_allowed(p, cs->cpus_allowed);
- put_task_struct(p);
+ set_cpus_allowed(q, cs->cpus_allowed);
+ put_task_struct(q);
}
/*
* If we had to process any tasks at all, scan again
@@ -1269,7 +1269,8 @@ static ssize_t cpuset_common_file_write(struct cgroup *cont,
return -E2BIG;

/* +1 for nul-terminator */
- if ((buffer = kmalloc(nbytes + 1, GFP_KERNEL)) == 0)
+ buffer = kmalloc(nbytes + 1, GFP_KERNEL);
+ if (!buffer)
return -ENOMEM;

if (copy_from_user(buffer, userbuf, nbytes)) {
--
1.5.4.rc5.1138.g2602