diff mbox series

[v2,1/3] fs/efs: Use correct brace styling for statements

Message ID 20210205051429.553657-2-enbyamy@gmail.com (mailing list archive)
State New, archived
Headers show
Series fs/efs: Follow kernel style guide | expand

Commit Message

Amy Parker Feb. 5, 2021, 5:14 a.m. UTC
Many single-line statements have unnecessary braces, and some statement 
pairs have mismatched braces. This is a clear violation of the kernel 
style guide, which mandates that single line statements have no braces 
and that pairs with at least one multi-line block maintain their braces.

This patch fixes these style violations. Single-line statements that 
have braces have had their braces stripped. Pair single-line statements 
have been formatted per the style guide. Pair mixed-line statements have 
had their braces updated to conform.

Signed-off-by: Amy Parker <enbyamy@gmail.com>
---
 fs/efs/inode.c | 10 ++++++----
 fs/efs/super.c | 15 ++++++---------
 2 files changed, 12 insertions(+), 13 deletions(-)

Comments

Joe Perches Feb. 5, 2021, 6 a.m. UTC | #1
On Thu, 2021-02-04 at 21:14 -0800, Amy Parker wrote:
> Many single-line statements have unnecessary braces, and some statement 
> pairs have mismatched braces. This is a clear violation of the kernel 
> style guide, which mandates that single line statements have no braces 
> and that pairs with at least one multi-line block maintain their braces.
> 
> This patch fixes these style violations. Single-line statements that 
> have braces have had their braces stripped. Pair single-line statements 
> have been formatted per the style guide. Pair mixed-line statements have 
> had their braces updated to conform.
> 
> Signed-off-by: Amy Parker <enbyamy@gmail.com>
> ---
>  fs/efs/inode.c | 10 ++++++----
>  fs/efs/super.c | 15 ++++++---------
>  2 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/efs/inode.c b/fs/efs/inode.c
> @@ -120,8 +120,10 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
>  			device = 0;
>  		else
>  			device = MKDEV(sysv_major(rdev), sysv_minor(rdev));
> -	} else
> +	}
> +	else {

Not the kernel specified style.

	} else {

Try using checkpatch on your proposed patches.
diff mbox series

Patch

diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 89e73a6f0d36..36d6c45046e2 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -107,11 +107,11 @@  struct inode *efs_iget(struct super_block *super, unsigned long ino)
 	inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0;
 
 	/* this is the number of blocks in the file */
-	if (inode->i_size == 0) {
+	if (inode->i_size == 0)
 		inode->i_blocks = 0;
-	} else {
+	else
 		inode->i_blocks = ((inode->i_size - 1) >> EFS_BLOCKSIZE_BITS) + 1;
-	}
+
 
 	rdev = be16_to_cpu(efs_inode->di_u.di_dev.odev);
 	if (rdev == 0xffff) {
@@ -120,8 +120,10 @@  struct inode *efs_iget(struct super_block *super, unsigned long ino)
 			device = 0;
 		else
 			device = MKDEV(sysv_major(rdev), sysv_minor(rdev));
-	} else
+	}
+	else {
 		device = old_decode_dev(rdev);
+	}
 
 	/* get the number of extents for this object */
 	in->numextents = be16_to_cpu(efs_inode->di_numextents);
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 62b155b9366b..874d82096b2f 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -160,14 +160,13 @@  static efs_block_t efs_validate_vh(struct volume_header *vh) {
 	struct pt_types	*pt_entry;
 	int		pt_type, slice = -1;
 
-	if (be32_to_cpu(vh->vh_magic) != VHMAGIC) {
+	if (be32_to_cpu(vh->vh_magic) != VHMAGIC)
 		/*
 		 * assume that we're dealing with a partition and allow
 		 * read_super() to try and detect a valid superblock
 		 * on the next block.
 		 */
 		return 0;
-	}
 
 	ui = ((__be32 *) (vh + 1)) - 1;
 	for(csum = 0; ui >= ((__be32 *) vh);) {
@@ -191,11 +190,11 @@  static efs_block_t efs_validate_vh(struct volume_header *vh) {
 		}
 		name[j] = (char) 0;
 
-		if (name[0]) {
+		if (name[0])
 			pr_debug("vh: %8s block: 0x%08x size: 0x%08x\n",
 				name, (int) be32_to_cpu(vh->vh_vd[i].vd_lbn),
 				(int) be32_to_cpu(vh->vh_vd[i].vd_nbytes));
-		}
+
 	}
 #endif
 
@@ -219,15 +218,14 @@  static efs_block_t efs_validate_vh(struct volume_header *vh) {
 		}
 	}
 
-	if (slice == -1) {
+	if (slice == -1)
 		pr_notice("partition table contained no EFS partitions\n");
 #ifdef DEBUG
-	} else {
+	else
 		pr_info("using slice %d (type %s, offset 0x%x)\n", slice,
 			(pt_entry->pt_name) ? pt_entry->pt_name : "unknown",
 			sblock);
 #endif
-	}
 	return sblock;
 }
 
@@ -284,9 +282,8 @@  static int efs_fill_super(struct super_block *s, void *d, int silent)
 	sb->fs_start = efs_validate_vh((struct volume_header *) bh->b_data);
 	brelse(bh);
 
-	if (sb->fs_start == -1) {
+	if (sb->fs_start == -1)
 		return -EINVAL;
-	}
 
 	bh = sb_bread(s, sb->fs_start + EFS_SUPER);
 	if (!bh) {