* [PATCH] jfs: Remove unneeded return variable
@ 2021-02-04 3:39 Yang Li
2021-02-04 22:07 ` Dave Kleikamp
0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-02-04 3:39 UTC (permalink / raw)
To: shaggy; +Cc: jfs-discussion, linux-kernel, 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
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
fs/jfs/jfs_txnmgr.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index dca8edd..87ef2a2 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -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;
}
/*
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] jfs: Remove unneeded return variable
2021-02-04 3:39 [PATCH] jfs: Remove unneeded return variable Yang Li
@ 2021-02-04 22:07 ` Dave Kleikamp
0 siblings, 0 replies; 2+ messages in thread
From: Dave Kleikamp @ 2021-02-04 22:07 UTC (permalink / raw)
To: Yang Li; +Cc: jfs-discussion, linux-kernel
On 2/3/21 9:39 PM, Yang Li wrote:
> 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
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
> fs/jfs/jfs_txnmgr.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
> index dca8edd..87ef2a2 100644
> --- a/fs/jfs/jfs_txnmgr.c
> +++ b/fs/jfs/jfs_txnmgr.c
> @@ -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;
> }
>
> /*
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-04 22:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 3:39 [PATCH] jfs: Remove unneeded return variable Yang Li
2021-02-04 22:07 ` Dave Kleikamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).