kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] proc/fd: Remove unnecessary {files, f_flags, file} initialization in seq_show()
@ 2020-06-12 16:09 Kaitao Cheng
  2020-06-12 16:45 ` [PATCH v2] proc/fd: Remove unnecessary variable initialisations " Markus Elfring
  2020-07-07  7:23 ` [PATCH v2] proc/fd: Adjust " Markus Elfring
  0 siblings, 2 replies; 16+ messages in thread
From: Kaitao Cheng @ 2020-06-12 16:09 UTC (permalink / raw)
  To: adobriyan, Markus.Elfring
  Cc: linux-kernel, linux-fsdevel, songmuchun, kernel-janitors, Kaitao Cheng

'files' will be immediately reassigned. 'f_flags' and 'file' will be
overwritten in the if{} or seq_show() directly exits with an error.
so we don't need to consume CPU resources to initialize them.

Signed-off-by: Kaitao Cheng <pilgrimtao@gmail.com>
---

v2 ChangeLog:
  1. Fix some commit message
  2. Remove unnecessary f_flags initialization

 fs/proc/fd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 81882a13212d..d3854b76e95e 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -19,9 +19,9 @@
 
 static int seq_show(struct seq_file *m, void *v)
 {
-	struct files_struct *files = NULL;
-	int f_flags = 0, ret = -ENOENT;
-	struct file *file = NULL;
+	struct files_struct *files;
+	int f_flags, ret = -ENOENT;
+	struct file *file;
 	struct task_struct *task;
 
 	task = get_proc_task(m->private);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-07-07  7:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 16:09 [PATCH v2] proc/fd: Remove unnecessary {files, f_flags, file} initialization in seq_show() Kaitao Cheng
2020-06-12 16:45 ` [PATCH v2] proc/fd: Remove unnecessary variable initialisations " Markus Elfring
2020-06-12 17:00   ` Matthew Wilcox
2020-06-12 17:03     ` Markus Elfring
2020-06-12 17:03     ` Markus Elfring
2020-06-12 17:04       ` Matthew Wilcox
2020-06-12 18:22         ` [v2] " Markus Elfring
2020-06-12 18:28           ` Matthew Wilcox
2020-06-12 18:43             ` Markus Elfring
2020-06-12 18:47               ` Matthew Wilcox
2020-06-12 19:00                 ` Markus Elfring
2020-06-12 19:00                 ` Markus Elfring
2020-06-12 19:02                   ` Matthew Wilcox
2020-06-12 19:49                   ` Al Viro
2020-06-14  7:12   ` [PATCH v2] " Greg KH
2020-07-07  7:23 ` [PATCH v2] proc/fd: Adjust " Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).