* [PATCH] 9p/fs: Different branch return the same value
@ 2024-11-16 15:26 Rex Nie
2024-11-16 16:06 ` Christian Schoenebeck
2024-11-16 16:54 ` Christophe JAILLET
0 siblings, 2 replies; 3+ messages in thread
From: Rex Nie @ 2024-11-16 15:26 UTC (permalink / raw)
To: ericvh, lucho, asmadeus, linux_oss; +Cc: linux-kernel, Rex Nie
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.
Signed-off-by: Rex Nie <rexnie3@gmail.com>
---
fs/9p/v9fs.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 281a1ed03a04..ee0a374e0d9d 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -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)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] 9p/fs: Different branch return the same value
2024-11-16 15:26 [PATCH] 9p/fs: Different branch return the same value Rex Nie
@ 2024-11-16 16:06 ` Christian Schoenebeck
2024-11-16 16:54 ` Christophe JAILLET
1 sibling, 0 replies; 3+ messages in thread
From: Christian Schoenebeck @ 2024-11-16 16:06 UTC (permalink / raw)
To: ericvh, lucho, asmadeus, Rex Nie, Colin Ian King; +Cc: linux-kernel
On Saturday, November 16, 2024 4:26:12 PM CET Rex Nie wrote:
> 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.
>
> Signed-off-by: Rex Nie <rexnie3@gmail.com>
> ---
> fs/9p/v9fs.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
Too late to the party: :)
https://lore.kernel.org/all/20241107095756.10261-1-colin.i.king@gmail.com/
But thanks!
/Christian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] 9p/fs: Different branch return the same value
2024-11-16 15:26 [PATCH] 9p/fs: Different branch return the same value Rex Nie
2024-11-16 16:06 ` Christian Schoenebeck
@ 2024-11-16 16:54 ` Christophe JAILLET
1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-11-16 16:54 UTC (permalink / raw)
To: Rex Nie, ericvh, lucho, asmadeus, linux_oss; +Cc: linux-kernel
Le 16/11/2024 à 16:26, Rex Nie a écrit :
> 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.
>
> Signed-off-by: Rex Nie <rexnie3@gmail.com>
> ---
> fs/9p/v9fs.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
> index 281a1ed03a04..ee0a374e0d9d 100644
> --- a/fs/9p/v9fs.c
> +++ b/fs/9p/v9fs.c
> @@ -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)
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/20241107095756.10261-1-colin.i.king@gmail.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-16 16:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-16 15:26 [PATCH] 9p/fs: Different branch return the same value Rex Nie
2024-11-16 16:06 ` Christian Schoenebeck
2024-11-16 16:54 ` Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®