Skip to contentSkip to conversation

fs/ntfs3: Fix various styling issues

PATCH In review Kari Argillander 2 participants 6 messages Sep 7, 2021 – Sep 16, 2021 NTFS3 filesystem

lore
Share & tools
lore
#0 lore raw

v2 cover fs/ntfs3: Fix various styling issues

Fix various checkpatch warnings. There will still be some but they will be addressed in different patch sets.

v2:
- Remove + sign completly in 1/4 (Thanks Joe)
- I dropped one patch as it addressed else were [1]. (Thanks Joe)
- Drop newline in 3/4

[1]: lore.kernel.org/ntfs3/[email protected]

Kari Argillander (4):
fs/ntfs3: Remove '+' before constant in ni_insert_resident() fs/ntfs3: Place Comparisons constant right side of the test fs/ntfs3: Remove braces from single statment block fs/ntfs3: Remove tabs before spaces from comment

 fs/ntfs3/frecord.c | 7 +++----
 fs/ntfs3/lznt.c    | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

base-commit: d3624466b56dd5b1886c1dff500525b544c19c83

Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/4 fs/ntfs3: Remove '+' before constant in ni_insert_resident()

No need for plus sign here. So remove it. Checkpatch will also be happy.

---
 fs/ntfs3/frecord.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/frecord.c +1 -1
index 938b12d56ca6..d1477cabe3c7 100644
@@ -1451,7 +1451,7 @@ int ni_insert_resident(struct ntfs_inode *ni, u32 data_size,
 		attr->res.flags = RESIDENT_FLAG_INDEXED;
 
 		/* is_attr_indexed(attr)) == true */
-		le16_add_cpu(&ni->mi.mrec->hard_links, +1);
+		le16_add_cpu(&ni->mi.mrec->hard_links, 1);
 		ni->mi.dirty = true;
 	}
 	attr->res.res = 0;
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/4 fs/ntfs3: Place Comparisons constant right side of the test

In reply to Kari Argillander

For better code readability place constant always right side of the test. This will also address checkpatch warning.

---
 fs/ntfs3/frecord.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/frecord.c +1 -1
index d1477cabe3c7..d3c1c46cfb0a 100644
@@ -1606,7 +1606,7 @@ struct ATTR_FILE_NAME *ni_fname_type(struct ntfs_inode *ni, u8 name_type,
 
 	*le = NULL;
 
-	if (FILE_NAME_POSIX == name_type)
+	if (name_type == FILE_NAME_POSIX)
 		return NULL;
 
 	/* Enumerate all names. */
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/4 fs/ntfs3: Remove braces from single statment block

In reply to Kari Argillander

Remove braces from single statment block as they are not needed. Also Linux kernel coding style guide recommend this and checkpatch warn about this.

---
 fs/ntfs3/frecord.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ntfs3/frecord.c +1 -2
index d3c1c46cfb0a..549ad245269a 100644
@@ -2906,9 +2906,8 @@ bool ni_remove_name_undo(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
 		memcpy(Add2Ptr(attr, SIZEOF_RESIDENT), de + 1, de_key_size);
 		mi_get_ref(&ni->mi, &de->ref);
 
-		if (indx_insert_entry(&dir_ni->dir, dir_ni, de, sbi, NULL, 1)) {
+		if (indx_insert_entry(&dir_ni->dir, dir_ni, de, sbi, NULL, 1))
 			return false;
-		}
 	}
 
 	return true;
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 4/4 fs/ntfs3: Remove tabs before spaces from comment

In reply to Kari Argillander

Remove tabs before spaces from comment as recommended by kernel coding style. Checkpatch also warn about these.

---
 fs/ntfs3/lznt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/lznt.c +1 -1
index f1f691a67cc4..734a251deae9 100644
@@ -292,7 +292,7 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
 /*
  * get_lznt_ctx
  * @level: 0 - Standard compression.
- * 	   !0 - Best compression, requires a lot of cpu.
+ *	   !0 - Best compression, requires a lot of cpu.
  */
 struct lznt *get_lznt_ctx(int level)
 {
Signature · 1 line
2.25.1
#5 lore raw
In reply to Kari Argillander
Quoted 16 lines · Kari Argillander

Fix various checkpatch warnings. There will still be some but they will be addressed in different patch sets.

v2:
- Remove + sign completly in 1/4 (Thanks Joe)
- I dropped one patch as it addressed else were [1]. (Thanks Joe)
- Drop newline in 3/4

[1]: lore.kernel.org/ntfs3/[email protected]

Kari Argillander (4):
fs/ntfs3: Remove '+' before constant in ni_insert_resident() fs/ntfs3: Place Comparisons constant right side of the test fs/ntfs3: Remove braces from single statment block fs/ntfs3: Remove tabs before spaces from comment

Quoted 7 lines
 fs/ntfs3/frecord.c | 7 +++----
 fs/ntfs3/lznt.c    | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

base-commit: d3624466b56dd5b1886c1dff500525b544c19c83

Hi, Kari, Joe!
Applied, thanks!