Skip to contentSkip to conversation

Fix multiple checkpatch issues

PATCH New Gargi Sharma 1 participant 4 messages Mar 27, 2017 Namespaces:

lore
Share & tools
lore
#0 lore raw

v2 cover Fix multiple checkpatch issues

This patchset fixes multiple checkpatch issues
in pid_namespace.c file.

---
Changes in v2:
Patch 1
- Fix splitting of line for better readablilty.

Gargi Sharma (3):
kernel: pid_namespace: Fix line over 80 characters
kernel: pid_namespace: Do not initialise statics to 0
kernel: pid_namespace: Remove return statement from void function

 kernel/pid_namespace.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/3 kernel: pid_namespace: Fix line over 80 characters

Line over 80 characters are split to fix the following checkpatch issue:
WARNING: line over 80 characters

---
 kernel/pid_namespace.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/pid_namespace.c +3 -2
index a4f9a75..9315258 100644
@@ -92,8 +92,9 @@ static void dec_pid_namespaces(struct ucounts *ucounts)
 	dec_ucount(ucounts, UCOUNT_PID_NAMESPACES);
 }
 
-static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns,
-	struct pid_namespace *parent_pid_ns)
+static struct pid_namespace *
+create_pid_namespace(struct user_namespace *user_ns,
+		     struct pid_namespace *parent_pid_ns)
 {
 	struct pid_namespace *ns;
 	unsigned int level = parent_pid_ns->level + 1;
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/3 kernel: pid_namespace: Do not initialise statics to 0

In reply to Gargi Sharma

Static variables are initialised to 0 by GCC.
Fixes the following checkpatch error:
ERROR: do not initialise statics to 0 or NULL

---
 kernel/pid_namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/pid_namespace.c +1 -1
index 9315258..9d4c53d 100644
@@ -312,7 +312,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.7.4
#3 lore raw

PATCH v2 3/3 kernel: pid_namespace: Remove return statement from void function

In reply to Gargi Sharma

zap_pid_ns_processes is a void function and the return statement at the end is not useful.

Found with checkpatch.

---
 kernel/pid_namespace.c | 1 -
 1 file changed, 1 deletion(-)
kernel/pid_namespace.c +0 -1
index 9d4c53d..0afec4c 100644
@@ -288,7 +288,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.7.4