Skip to contentSkip to conversation

fs/ntfs3: Delete dead code in ni_write_frame()

PATCH In review Dan Carpenter 2 participants 2 messages Aug 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ntfs3: Delete dead code in ni_write_frame()

This code sets "lznt" to NULL and then kfrees it. Kfreeing a NULL is a no-op so delete the code.

---
 fs/ntfs3/frecord.c | 3 ---
 1 file changed, 3 deletions(-)
fs/ntfs3/frecord.c +0 -3
index c3121bf9c62f..c1a9f124f771 100644
@@ -2742,7 +2742,6 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
 	}
 
 	mutex_lock(&sbi->compress.mtx_lznt);
-	lznt = NULL;
 	if (!sbi->compress.lznt) {
 		/*
 		 * lznt implements two levels of compression:
@@ -2758,14 +2757,12 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
 		}
 
 		sbi->compress.lznt = lznt;
-		lznt = NULL;
 	}
 
 	/* compress: frame_mem -> frame_ondisk */
 	compr_size = compress_lznt(frame_mem, frame_size, frame_ondisk,
 				   frame_size, sbi->compress.lznt);
 	mutex_unlock(&sbi->compress.mtx_lznt);
-	ntfs_free(lznt);
 
 	if (compr_size + sbi->cluster_size > frame_size) {
 		/* frame is not compressed */
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

This code sets "lznt" to NULL and then kfrees it. Kfreeing a NULL is a no-op so delete the code.

Quoted 35 lines
---
 fs/ntfs3/frecord.c | 3 ---
 1 file changed, 3 deletions(-)
fs/ntfs3/frecord.c +0 -3
index c3121bf9c62f..c1a9f124f771 100644
@@ -2742,7 +2742,6 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
 	}
 
 	mutex_lock(&sbi->compress.mtx_lznt);
-	lznt = NULL;
 	if (!sbi->compress.lznt) {
 		/*
 		 * lznt implements two levels of compression:
@@ -2758,14 +2757,12 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
 		}
 
 		sbi->compress.lznt = lznt;
-		lznt = NULL;
 	}
 
 	/* compress: frame_mem -> frame_ondisk */
 	compr_size = compress_lznt(frame_mem, frame_size, frame_ondisk,
 				   frame_size, sbi->compress.lznt);
 	mutex_unlock(&sbi->compress.mtx_lznt);
-	ntfs_free(lznt);
 
 	if (compr_size + sbi->cluster_size > frame_size) {
 		/* frame is not compressed */
Signature · 1 line
2.20.1