Skip to contentSkip to conversation

9p/fs: Different branch return the same value

PATCH In review Rex Nie 3 participants 3 messages Nov 16, 2024 9P file system

lore
Share & tools
lore

Rex Nie

author
#0 lore raw

PATCH 1/1 9p/fs: Different branch return the same value

The same code is executed when the condition ret < 0 is true or false. Remove the if branch and just return v9fs_init_inode_cache(). This does not change the semantics of the original code.

---
 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.17.1
#2 lore raw
In reply to Rex Nie

Le 16/11/2024 à 16:26, Rex Nie a écrit :

Quoted 17 lines

The same code is executed when the condition ret < 0 is true or false. Remove the if branch and just return v9fs_init_inode_cache(). This does not change the semantics of the original code.

---
  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)
 
  static int v9fs_cache_register(void)
  {

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

Quoted 10 lines
fs/9p/v9fs.c +1 -6
-	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)

Hi,

a similar patch has already been sent.

See [1], which is the v2 of the patch and goes one step further.

CJ

[1]: https://lore.kernel.org/linux-kernel/[email protected]/