Skip to contentSkip to conversation

Fix multiple checkpatch issues

PATCH Superseded Gargi Sharma 3 participants 8 messages Mar 26, 2017 – Mar 27, 2017 Namespaces:

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix multiple checkpatch issues

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

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

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

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

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 5f29687..6ace1e3 100644
@@ -287,7 +287,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
#3 lore raw

PATCH 2/3 kernel: pid_namespace: Fix line over 80 characters

In reply to Gargi Sharma

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 6ace1e3..18f5385 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
#7 lore raw

PATCH 3/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 18f5385..071ebd3 100644
@@ -311,7 +311,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
#2 lore raw

RE: [PATCH 1/3] kernel: pid_namespace: Remove return statement from void function

In reply to Gargi Sharma

Yes, I agree.

I'm going to start a git tree with these various cleanups in it so Gargi and Varsha aren't duplicating each other's work so much :-)

Quoted 34 lines

-----Original Message-----
From: Gargi Sharma [mailto:[email protected]]
Sent: Sunday, March 26, 2017 10:48 AM
To: Matthew Wilcox <[email protected]>
Cc: [email protected]; Gargi Sharma <[email protected]>
Subject: [PATCH 1/3] kernel: pid_namespace: Remove return statement from void function

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 5f29687..6ace1e3 100644
@@ -287,7 +287,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
--
2.7.4

#4 lore raw

RE: [PATCH 2/3] kernel: pid_namespace: Fix line over 80 characters

In reply to Gargi Sharma

Ooh, no, don't split it here. People grep for 'struct pid_namespace' and this split will mean they don't find it. I would probably split it between the '*' and the 'create'. You could also split it between the 'static' and the 'struct'.

Quoted 36 lines

-----Original Message-----
From: Gargi Sharma [mailto:[email protected]]
Sent: Sunday, March 26, 2017 10:48 AM
To: Matthew Wilcox <[email protected]>
Cc: [email protected]; Gargi Sharma <[email protected]>
Subject: [PATCH 2/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 6ace1e3..18f5385 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;
--
2.7.4

#5 lore raw

Re: [PATCH 2/3] kernel: pid_namespace: Fix line over 80 characters

In reply to Gargi Sharma
Quoted 15 lines · Gargi Sharma

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

Signed-off-by Gargi Sharma <[email protected] <javascript:>>

---

 kernel/pid_namespace.c | 5 +++-- 
 1 file changed, 3 insertions(+), 2 deletions(-) 
kernel/pid_namespace.c +0 -0
index 6ace1e3..18f5385 100644 

kernel/pid_namespace.c static void dec_pid_namespaces(struct ucounts *ucounts) · line 96

Quoted 7 lines
kernel/pid_namespace.c +0 -2
@@ -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) 
 

Hi Gargi
I think I have already made this change
Thanks
Arushi

Quoted 10 lines
kernel/pid_namespace.c +3 -0
+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 
#6 lore raw

Re: [PATCH 2/3] kernel: pid_namespace: Fix line over 80 characters

Quoted 22 lines · Arushi Singhal
Quoted 18 lines · Gargi Sharma

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 +0 -0
index 6ace1e3..18f5385 100644 
@@ -92,8 +92,9 @@ static void dec_pid_namespaces(struct ucounts *ucounts) 
         dec_ucount(ucounts, UCOUNT_PID_NAMESPACES); 
 } 
 
Quoted 9 lines

kernel/pid_namespace.c static void dec_pid_namespaces(struct ucounts *ucounts) · line 96

Quoted 4 lines
kernel/pid_namespace.c +0 -2
-static struct pid_namespace *create_pid_namespace(struct user_namespace 
 *user_ns, 
-        struct pid_namespace *parent_pid_ns) 
 

Hi Gargi
I think I have already made this change
Thanks
Arushi

Sorry
My bad I have done the similar patch but not on same. Thanks
Arushi

Quoted 10 lines

+static struct

Quoted 9 lines
kernel/pid_namespace.c +2 -0
+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