Skip to contentSkip to conversation

proc: Remove unnecessary ‘NULL’ and '0' values

PATCH In review Li zeming 2 participants 2 messages Oct 8, 2022 – Oct 9, 2022

Subsystems (3)
lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 proc: Remove unnecessary ‘NULL’ and '0' values

Remove unnecessary initialization assignments, which are used after the assignment.

---
 fs/proc/proc_sysctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/proc/proc_sysctl.c +2 -2
index 021e83fe831f..5fc367f0044a 100644
@@ -694,7 +694,7 @@ static bool proc_sys_fill_cache(struct file *file,
 	struct dentry *child, *dir = file->f_path.dentry;
 	struct inode *inode;
 	struct qstr qname;
-	ino_t ino = 0;
+	ino_t ino;
 	unsigned type = DT_UNKNOWN;
 
 	qname.name = table->procname;
@@ -1246,7 +1246,7 @@ static bool get_links(struct ctl_dir *dir,
 static int insert_links(struct ctl_table_header *head)
 {
 	struct ctl_table_set *root_set = &sysctl_table_root.default_set;
-	struct ctl_dir *core_parent = NULL;
+	struct ctl_dir *core_parent;
 	struct ctl_table_header *links;
 	int err;
 
Signature · 1 line
2.18.2
#1 lore raw
Quoted 2 lines · Li zeming

Remove unnecessary initialization assignments, which are used after the assignment.

They don't hurt anything, and in fact show the intent of the initial variable state. Additionally, the compiler will drop it once it finds the later assignment.

-Kees

Signature · 1 line
Kees Cook