lkml.org 
[lkml]   [2020]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] proc/fd: Remove unnecessary {files, f_flags, file} initialization in seq_show()
Date
'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
\
 
 \ /
  Last update: 2020-06-12 18:11    [W:1.435 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site