diff mbox series

[next] fs/9p: remove redundant variable ret

Message ID 20241106152209.1626630-1-colin.i.king@gmail.com (mailing list archive)
State New
Headers show
Series [next] fs/9p: remove redundant variable ret | expand

Commit Message

Colin Ian King Nov. 6, 2024, 3:22 p.m. UTC
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.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/9p/v9fs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Dan Carpenter Nov. 6, 2024, 9:45 p.m. UTC | #1
On Wed, Nov 06, 2024 at 03:22:09PM +0000, Colin Ian King wrote:
> 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.
> 
> Signed-off-by: Colin Ian King <colin.i.king@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();
>  }

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

regards,
dan carpenter
Dominique Martinet Nov. 6, 2024, 10:54 p.m. UTC | #2
Dan Carpenter wrote on Thu, Nov 07, 2024 at 12:45:33AM +0300:
> On Wed, Nov 06, 2024 at 03:22:09PM +0000, Colin Ian King wrote:
> > 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!
Colin Ian King Nov. 7, 2024, 9:14 a.m. UTC | #3
On 06/11/2024 22:54, Dominique Martinet wrote:
> Dan Carpenter wrote on Thu, Nov 07, 2024 at 12:45:33AM +0300:
>> On Wed, Nov 06, 2024 at 03:22:09PM +0000, Colin Ian King wrote:
>>> 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!
OK, will do.

Colin
diff mbox series

Patch

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)