Skip to contentSkip to conversation

kernel: pid: Multiple checkpatch issues.

PATCH New Arushi Singhal 1 participant 6 messages Mar 28, 2017 Namespaces:

lore
Share & tools
lore
#0 lore raw

cover kernel: pid: Multiple checkpatch issues.

Fix multiple checkpatch.pl issue to improve code readability.

Arushi Singhal (5):
kernel: pid: remove space after open square bracket
kernel: pid.c: Add space before the open parenthesis
kernel: pid: Fix line over 80 characters
kernel: pid_namespace: Remove return statement from void function
kernel: pid_namespace.c: Do not initialise statics to 0.

 kernel/pid.c           |  8 +++++---
 kernel/pid_namespace.c | 10 ++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/5 kernel: pid: remove space after open square bracket

Remove the space after open square bracket as reported by checkpatch.pl.

---
 kernel/pid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/pid.c +1 -1
index 0143ac0ddceb..59ec7a671e06 100644
@@ -71,7 +71,7 @@ static inline int mk_pid(struct pid_namespace *pid_ns,
 struct pid_namespace init_pid_ns = {
 	.kref = KREF_INIT(2),
 	.pidmap = {
-		[ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
+		[0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
 	},
 	.last_pid = 0,
 	.nr_hashed = PIDNS_HASH_ADDING,
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/5 kernel: pid.c: Add space before the open parenthesis

In reply to Arushi Singhal

Add the space before open parenthesis as reported by checkpatch.pl

---
 kernel/pid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/pid.c +1 -1
index 59ec7a671e06..5822142ca92a 100644
@@ -266,7 +266,7 @@ void free_pid(struct pid *pid)
 		struct upid *upid = pid->numbers + i;
 		struct pid_namespace *ns = upid->ns;
 		hlist_del_rcu(&upid->pid_chain);
-		switch(--ns->nr_hashed) {
+		switch (--ns->nr_hashed) {
 		case 2:
 		case 1:
 			/* When all that is left in the pid namespace
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/5 kernel: pid: Fix line over 80 characters

In reply to Arushi Singhal

This patch splits line over 80 characters addressing checkpatch.pl warning

---
 kernel/pid.c           | 4 +++-
 kernel/pid_namespace.c | 7 +++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
kernel/pid.c +3 -1
index 5822142ca92a..dd514309d982 100644
@@ -439,7 +439,9 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type)
 		first = rcu_dereference_check(hlist_first_rcu(&pid->tasks[type]),
 					      lockdep_tasklist_lock_is_held());
 		if (first)
-			result = hlist_entry(first, struct task_struct, pids[(type)].node);
+			result = hlist_entry(first,
+					     struct task_struct,
+					     pids[(type)].node);
 	}
 	return result;
 }
kernel/pid_namespace.c +5 -2
index de461aa0bf9a..778959ecd5c3 100644
@@ -75,7 +75,9 @@ static struct kmem_cache *create_pid_cachep(int nr_ids)
 
 static void proc_cleanup_work(struct work_struct *work)
 {
-	struct pid_namespace *ns = container_of(work, struct pid_namespace, proc_work);
+	struct pid_namespace *ns = container_of(work,
+						struct pid_namespace,
+						proc_work);
 	pid_ns_release_proc(ns);
 }
 
@@ -89,7 +91,8 @@ static struct ucounts *inc_pid_namespaces(struct user_namespace *ns)
 
 static void dec_pid_namespaces(struct ucounts *ucounts)
 {
-	dec_ucount(ucounts, UCOUNT_PID_NAMESPACES);
+	dec_ucount(ucounts,
+		   UCOUNT_PID_NAMESPACES);
 }
 
 static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns,
Signature · 1 line
2.11.0
#4 lore raw

PATCH 4/5 kernel: pid_namespace: Remove return statement from void function

In reply to Arushi Singhal

Remove the return statement from void function as is not useful.

---
 kernel/pid_namespace.c | 1 -
 1 file changed, 1 deletion(-)
kernel/pid_namespace.c +0 -1
index 778959ecd5c3..be35c2fe725f 100644
@@ -291,7 +291,6 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
 		current->signal->group_exit_code = pid_ns->reboot;
 
 	acct_exit_ns(pid_ns);
-	return;
 }
 
 #ifdef CONFIG_CHECKPOINT_RESTORE
Signature · 1 line
2.11.0
#5 lore raw

PATCH 5/5 kernel: pid_namespace.c: Do not initialise statics to 0.

In reply to Arushi Singhal

Do not initialise statics to 0.
static variable by default initialise to 0,so no need to explicite initialisation.
This issue was found by checkpatch.

---
 kernel/pid_namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/pid_namespace.c +1 -1
index be35c2fe725f..1bfbee50177b 100644
@@ -314,7 +314,7 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write,
 }
 
 extern int pid_max;
-static int zero = 0;
+static int zero;
 static struct ctl_table pid_ns_ctl_table[] = {
 	{
 		.procname = "ns_last_pid",
Signature · 1 line
2.11.0