Skip to contentSkip to conversation

jfs: Remove unneeded return variable

PATCH In review Yang Li 2 participants 2 messages Feb 4, 2021 JFS filesystem

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 jfs: Remove unneeded return variable

This patch removes unneeded return variables, using only '0' instead.
It fixes the following warning detected by coccinelle:
./fs/jfs/jfs_txnmgr.c:1370:5-7: Unneeded variable: "rc". Return "0" on line 1417

---
 fs/jfs/jfs_txnmgr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/jfs/jfs_txnmgr.c +2 -4
index dca8edd..87ef2a2 100644
@@ -1367,7 +1367,6 @@ int txCommit(tid_t tid,		/* transaction identifier */
  */
 static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
 {
-	int rc = 0;
 	struct inode *ip;
 	lid_t lid;
 	struct tlock *tlck;
@@ -1414,7 +1413,7 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
 		}
 	}
 
-	return rc;
+	return 0;
 }
 
 /*
@@ -1425,7 +1424,6 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
 static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
 		 struct tlock * tlck, struct commit * cd)
 {
-	int rc = 0;
 	struct metapage *mp;
 	pxd_t *pxd;
 	struct pxd_lock *pxdlock;
@@ -1527,7 +1525,7 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
 	}
 #endif				/* _JFS_WIP */
 
-	return rc;
+	return 0;
 }
 
 /*
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · Yang Li

This patch removes unneeded return variables, using only '0' instead.
It fixes the following warning detected by coccinelle:
./fs/jfs/jfs_txnmgr.c:1370:5-7: Unneeded variable: "rc". Return "0" on line 1417

Looks good. I wonder if we should take it a step further and turn diLog(), dataLog() and txLog() into void functions.

Shaggy

Quoted 46 lines
---
  fs/jfs/jfs_txnmgr.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
fs/jfs/jfs_txnmgr.c +2 -4
index dca8edd..87ef2a2 100644
@@ -1367,7 +1367,6 @@ int txCommit(tid_t tid,		/* transaction identifier */
   */
  static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
  {
-	int rc = 0;
  	struct inode *ip;
  	lid_t lid;
  	struct tlock *tlck;
@@ -1414,7 +1413,7 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
  		}
  	}
 
-	return rc;
+	return 0;
  }
 
  /*
@@ -1425,7 +1424,6 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
  static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
  		 struct tlock * tlck, struct commit * cd)
  {
-	int rc = 0;
  	struct metapage *mp;
  	pxd_t *pxd;
  	struct pxd_lock *pxdlock;
@@ -1527,7 +1525,7 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
  	}
  #endif				/* _JFS_WIP */
 
-	return rc;
+	return 0;
  }
 
  /*