Skip to contentSkip to conversation

fs/9p: remove redundant variable ret

PATCH In review Colin Ian King 3 participants 4 messages Nov 6, 2024 – Nov 7, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/9p: remove redundant variable ret

The assignments and return checks on ret are redundant. Clean up the code by just returning the return value from the call to v9fs_init_inode_cache.

---
 fs/9p/v9fs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/9p/v9fs.c +1 -6
index 281a1ed03a04..ee0a374e0d9d 100644
@@ -661,12 +661,7 @@ static void v9fs_destroy_inode_cache(void)
 
 static int v9fs_cache_register(void)
 {
-	int ret;
-
-	ret = v9fs_init_inode_cache();
-	if (ret < 0)
-		return ret;
-	return ret;
+	return v9fs_init_inode_cache();
 }
 
 static void v9fs_cache_unregister(void)
Signature · 1 line
2.39.5
#1 lore raw
Quoted 15 lines · Colin Ian King

The assignments and return checks on ret are redundant. Clean up the code by just returning the return value from the call to v9fs_init_inode_cache.

---
 fs/9p/v9fs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/9p/v9fs.c +0 -0
index 281a1ed03a04..ee0a374e0d9d 100644
@@ -661,12 +661,7 @@ static void v9fs_destroy_inode_cache(void)
 

fs/9p/v9fs.c static void v9fs_destroy_inode_cache(void) · line 665

Quoted 10 lines
fs/9p/v9fs.c +1 -6
 static int v9fs_cache_register(void)
 {
-	int ret;
-
-	ret = v9fs_init_inode_cache();
-	if (ret < 0)
-		return ret;
-	return ret;
+	return v9fs_init_inode_cache();
 }

Better to delete the whole function and call v9fs_init_inode_cache() directly.

regards,
dan carpenter

#2 lore raw

Dan Carpenter wrote on Thu, Nov 07, 2024 at 12:45:33AM +0300:

Quoted 8 lines · Colin Ian King
Quoted 3 lines

The assignments and return checks on ret are redundant. Clean up the code by just returning the return value from the call to v9fs_init_inode_cache.

[...]

Better to delete the whole function and call v9fs_init_inode_cache() directly.

Makes sense, and if we go there delete v9fs_cache_unregister as well so the init/destroy pair properly; that also is a single function call.

Thanks!

Signature · 1 line
Dominique Martinet | Asmadeus
#3 lore raw
Quoted 7 lines · Dominique Martinet

Dan Carpenter wrote on Thu, Nov 07, 2024 at 12:45:33AM +0300:

Quoted 6 lines · Colin Ian King
Quoted 3 lines

The assignments and return checks on ret are redundant. Clean up the code by just returning the return value from the call to v9fs_init_inode_cache.

[...]

Quoted 7 lines
Quoted 2 lines

Better to delete the whole function and call v9fs_init_inode_cache() directly.

Makes sense, and if we go there delete v9fs_cache_unregister as well so the init/destroy pair properly; that also is a single function call.

Thanks!

OK, will do.

Colin