Skip to contentSkip to conversation

staging : osc : Remove braces from single-line body

PATCH In review Tabrez khan 2 participants 4 messages Dec 15, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging : osc : Remove braces from single-line body

Remove unnecessary braces {} for single if statement block. This warning is found using checkpatch.pl.

---
 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -3
index 4bbe219..5ded31a 100644
@@ -1420,10 +1420,8 @@ static void osc_release_write_grant(struct client_obd *cli,
 				    struct brw_page *pga)
 {
 	assert_spin_locked(&cli->cl_loi_list_lock);
-	if (!(pga->flag & OBD_BRW_FROM_GRANT)) {
+	if (!(pga->flag & OBD_BRW_FROM_GRANT))
 		return;
-	}
-
 	pga->flag &= ~OBD_BRW_FROM_GRANT;
 	atomic_long_dec(&obd_dirty_pages);
 	cli->cl_dirty_pages--;
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 13 lines · Tabrez khan

Remove unnecessary braces {} for single if statement block. This warning is found using checkpatch.pl.

---
 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +0 -0
index 4bbe219..5ded31a 100644

drivers/staging/lustre/lustre/osc/osc_cache.c static void osc_release_write_grant(struct client_obd *cli, · line 1426

Quoted 8 lines
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -3
@@ -1420,10 +1420,8 @@ static void osc_release_write_grant(struct client_obd *cli,
 				    struct brw_page *pga)
 {
 	assert_spin_locked(&cli->cl_loi_list_lock);
-	if (!(pga->flag & OBD_BRW_FROM_GRANT)) {
+	if (!(pga->flag & OBD_BRW_FROM_GRANT))
 		return;
-	}
-

Why did you also delete the blank line?

#2 lore raw
Quoted 9 lines · Greg KH
Quoted 8 lines · Tabrez khan

Remove unnecessary braces {} for single if statement block. This warning is found using checkpatch.pl.

---
 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 15 lines

drivers/staging/lustre/lustre/osc/osc_cache.c static void osc_release_write_grant(struct client_obd *cli, · line 1426

Quoted 13 lines
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -3
index 4bbe219..5ded31a 100644
@@ -1420,10 +1420,8 @@ static void osc_release_write_grant(struct client_obd *cli,
                                  struct brw_page *pga)
 {
      assert_spin_locked(&cli->cl_loi_list_lock);
-     if (!(pga->flag & OBD_BRW_FROM_GRANT)) {
+     if (!(pga->flag & OBD_BRW_FROM_GRANT))
              return;
-     }
-

Why did you also delete the blank line?

Because to keep the kernel coding style as close as possible and after deleting brace it leads to extra empty line so i delete it. Please guide if done something wrong.

maintainer
#3 lore raw
Quoted 26 lines · Tabrez Khan
Quoted 9 lines · Greg KH
Quoted 8 lines · Tabrez khan

Remove unnecessary braces {} for single if statement block. This warning is found using checkpatch.pl.

---
 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 15 lines

drivers/staging/lustre/lustre/osc/osc_cache.c static void osc_release_write_grant(struct client_obd *cli, · line 1426

Quoted 13 lines
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -3
index 4bbe219..5ded31a 100644
@@ -1420,10 +1420,8 @@ static void osc_release_write_grant(struct client_obd *cli,
                                  struct brw_page *pga)
 {
      assert_spin_locked(&cli->cl_loi_list_lock);
-     if (!(pga->flag & OBD_BRW_FROM_GRANT)) {
+     if (!(pga->flag & OBD_BRW_FROM_GRANT))
              return;
-     }
-

Why did you also delete the blank line?

Quoted 3 lines

Because to keep the kernel coding style as close as possible and after deleting brace it leads to extra empty line so i delete it. Please guide if done something wrong.

The extra blank line is fine, please leave it, it makes the code more readable, don't you think?