Skip to contentSkip to conversation

fs/ntfs3/indx: Remove unnecessary 'NULL' values from Pointer

PATCH In review Li kunyu 2 participants 2 messages Jul 4, 2022 – Jul 6, 2022 NTFS3 filesystem

lore
Share & tools
lore

Li kunyu

author
#0 lore raw

PATCH 1/1 fs/ntfs3/indx: Remove unnecessary 'NULL' values from Pointer

Pointer variables allocate memory first, and then judge. There is no need to initialize the assignment.

---
 fs/ntfs3/index.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/index.c +2 -2
index 6f81e3a49abf..b5c92b6ce01c 100644
@@ -1685,8 +1685,8 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
 {
 	int err;
 	const struct NTFS_DE *sp;
-	struct NTFS_DE *e, *de_t, *up_e = NULL;
-	struct indx_node *n2 = NULL;
+	struct NTFS_DE *e, *de_t, *up_e;
+	struct indx_node *n2;
 	struct indx_node *n1 = fnd->nodes[level];
 	struct INDEX_HDR *hdr1 = &n1->index->ihdr;
 	struct INDEX_HDR *hdr2;
Signature · 1 line
2.18.2
#1 lore raw
Quoted 13 lines · Li kunyu

Pointer variables allocate memory first, and then judge. There is no need to initialize the assignment.

---
  fs/ntfs3/index.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/index.c +0 -0
index 6f81e3a49abf..b5c92b6ce01c 100644

fs/ntfs3/index.c indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni, · line 1692

Quoted 10 lines
fs/ntfs3/index.c +2 -2
@@ -1685,8 +1685,8 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
  {
  	int err;
  	const struct NTFS_DE *sp;
-	struct NTFS_DE *e, *de_t, *up_e = NULL;
-	struct indx_node *n2 = NULL;
+	struct NTFS_DE *e, *de_t, *up_e;
+	struct indx_node *n2;
  	struct indx_node *n1 = fnd->nodes[level];
  	struct INDEX_HDR *hdr1 = &n1->index->ihdr;
  	struct INDEX_HDR *hdr2;

Thanks for patch, applied!