[PATCH linux-next] btrfs: Remove the unneeded result variable

cgel.zte@gmail.com posted 1 patch 3 years, 7 months ago
fs/btrfs/sysfs.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
[PATCH linux-next] btrfs: Remove the unneeded result variable
Posted by cgel.zte@gmail.com 3 years, 7 months ago
From: zhang songyi <zhang.songyi@zte.com.cn>

Return the sysfs_emit() directly instead of storing it in another
redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
---
 fs/btrfs/sysfs.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 41f191682ad1..6268dade57d7 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -839,11 +839,8 @@ static ssize_t btrfs_sinfo_bg_reclaim_threshold_show(struct kobject *kobj,
 						     char *buf)
 {
 	struct btrfs_space_info *space_info = to_space_info(kobj);
-	ssize_t ret;
-
-	ret = sysfs_emit(buf, "%d\n", READ_ONCE(space_info->bg_reclaim_threshold));
 
-	return ret;
+	return sysfs_emit(buf, "%d\n", READ_ONCE(space_info->bg_reclaim_threshold));
 }
 
 static ssize_t btrfs_sinfo_bg_reclaim_threshold_store(struct kobject *kobj,
@@ -1205,11 +1202,8 @@ static ssize_t btrfs_bg_reclaim_threshold_show(struct kobject *kobj,
 					       char *buf)
 {
 	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
-	ssize_t ret;
-
-	ret = sysfs_emit(buf, "%d\n", READ_ONCE(fs_info->bg_reclaim_threshold));
 
-	return ret;
+	return sysfs_emit(buf, "%d\n", READ_ONCE(fs_info->bg_reclaim_threshold));
 }
 
 static ssize_t btrfs_bg_reclaim_threshold_store(struct kobject *kobj,
-- 
2.25.1
Re: [PATCH linux-next] btrfs: Remove the unneeded result variable
Posted by Anand Jain 3 years, 7 months ago
On 02/09/2022 15:48, cgel.zte@gmail.com wrote:
> From: zhang songyi <zhang.songyi@zte.com.cn>
> 
> Return the sysfs_emit() directly instead of storing it in another
> redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Re: [PATCH linux-next] btrfs: Remove the unneeded result variable
Posted by David Sterba 3 years, 7 months ago
On Fri, Sep 02, 2022 at 07:48:10AM +0000, cgel.zte@gmail.com wrote:
> From: zhang songyi <zhang.songyi@zte.com.cn>
> 
> Return the sysfs_emit() directly instead of storing it in another
> redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>

There's another patch doing a similar cleanup in btrfs_load_inode_props,
can you please resend so it's all done in one patch? I did not want to
apply a single fix but now that there are a few more instances of the
pattern it makes slightly more sense to apply it. Thanks.

https://lore.kernel.org/linux-btrfs/20220830083914.276926-1-ye.xingchen@zte.com.cn/