All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()'
@ 2021-09-18 19:56 Christophe JAILLET
  2021-09-18 19:56 ` [PATCH 2/2] fs/ntfs3: Remove a useless shadowing variable Christophe JAILLET
  2021-09-21 21:39 ` [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Kari Argillander
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2021-09-18 19:56 UTC (permalink / raw)
  To: almaz.alexandrovich; +Cc: ntfs3, kernel-janitors, Christophe JAILLET

'fnd' has been dereferenced several time before, so testing it here is
pointless.
Moreover, all callers of 'indx_find()' already have some error handling
code that makes sure that no NULL 'fnd' is passed.

So, remove the useless test.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/ntfs3/index.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 4f71a91f07d9..6f81e3a49abf 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -1072,9 +1072,7 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni,
 	if (!e)
 		return -EINVAL;
 
-	if (fnd)
-		fnd->root_de = e;
-
+	fnd->root_de = e;
 	err = 0;
 
 	for (;;) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] fs/ntfs3: Remove a useless shadowing variable
  2021-09-18 19:56 [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Christophe JAILLET
@ 2021-09-18 19:56 ` Christophe JAILLET
  2021-09-21 21:41   ` Kari Argillander
  2021-09-21 21:39 ` [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Kari Argillander
  1 sibling, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2021-09-18 19:56 UTC (permalink / raw)
  To: almaz.alexandrovich; +Cc: ntfs3, kernel-janitors, Christophe JAILLET

There is already a 'u8 mask' defined at the top of the function.
There is no need to define a new one here.

Remove the useless and shadowing new 'mask' variable.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/ntfs3/bitfunc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ntfs3/bitfunc.c b/fs/ntfs3/bitfunc.c
index bf10e2da5c6e..50d838093790 100644
--- a/fs/ntfs3/bitfunc.c
+++ b/fs/ntfs3/bitfunc.c
@@ -119,8 +119,7 @@ bool are_bits_set(const ulong *lmap, size_t bit, size_t nbits)
 
 	pos = nbits & 7;
 	if (pos) {
-		u8 mask = fill_mask[pos];
-
+		mask = fill_mask[pos];
 		if ((*map & mask) != mask)
 			return false;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()'
  2021-09-18 19:56 [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Christophe JAILLET
  2021-09-18 19:56 ` [PATCH 2/2] fs/ntfs3: Remove a useless shadowing variable Christophe JAILLET
@ 2021-09-21 21:39 ` Kari Argillander
  2021-09-23 16:11   ` Konstantin Komarov
  1 sibling, 1 reply; 5+ messages in thread
From: Kari Argillander @ 2021-09-21 21:39 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: almaz.alexandrovich, ntfs3, kernel-janitors

On Sat, Sep 18, 2021 at 09:56:19PM +0200, Christophe JAILLET wrote:
> 'fnd' has been dereferenced several time before, so testing it here is
> pointless.
> Moreover, all callers of 'indx_find()' already have some error handling
> code that makes sure that no NULL 'fnd' is passed.
> 
> So, remove the useless test.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Seems correct, thanks.

Reviewed-by: Kari Argillander <kari.argillander@gmail.com>

> ---
>  fs/ntfs3/index.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
> index 4f71a91f07d9..6f81e3a49abf 100644
> --- a/fs/ntfs3/index.c
> +++ b/fs/ntfs3/index.c
> @@ -1072,9 +1072,7 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni,
>  	if (!e)
>  		return -EINVAL;
>  
> -	if (fnd)
> -		fnd->root_de = e;
> -
> +	fnd->root_de = e;
>  	err = 0;
>  
>  	for (;;) {
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] fs/ntfs3: Remove a useless shadowing variable
  2021-09-18 19:56 ` [PATCH 2/2] fs/ntfs3: Remove a useless shadowing variable Christophe JAILLET
@ 2021-09-21 21:41   ` Kari Argillander
  0 siblings, 0 replies; 5+ messages in thread
From: Kari Argillander @ 2021-09-21 21:41 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: almaz.alexandrovich, ntfs3, kernel-janitors

On Sat, Sep 18, 2021 at 09:56:28PM +0200, Christophe JAILLET wrote:
> There is already a 'u8 mask' defined at the top of the function.
> There is no need to define a new one here.
> 
> Remove the useless and shadowing new 'mask' variable.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Kari Argillander <kari.argillander@gmail.com>

> ---
>  fs/ntfs3/bitfunc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs3/bitfunc.c b/fs/ntfs3/bitfunc.c
> index bf10e2da5c6e..50d838093790 100644
> --- a/fs/ntfs3/bitfunc.c
> +++ b/fs/ntfs3/bitfunc.c
> @@ -119,8 +119,7 @@ bool are_bits_set(const ulong *lmap, size_t bit, size_t nbits)
>  
>  	pos = nbits & 7;
>  	if (pos) {
> -		u8 mask = fill_mask[pos];
> -
> +		mask = fill_mask[pos];
>  		if ((*map & mask) != mask)
>  			return false;
>  	}
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()'
  2021-09-21 21:39 ` [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Kari Argillander
@ 2021-09-23 16:11   ` Konstantin Komarov
  0 siblings, 0 replies; 5+ messages in thread
From: Konstantin Komarov @ 2021-09-23 16:11 UTC (permalink / raw)
  To: Kari Argillander, Christophe JAILLET; +Cc: ntfs3, kernel-janitors



On 22.09.2021 00:39, Kari Argillander wrote:
> On Sat, Sep 18, 2021 at 09:56:19PM +0200, Christophe JAILLET wrote:
>> 'fnd' has been dereferenced several time before, so testing it here is
>> pointless.
>> Moreover, all callers of 'indx_find()' already have some error handling
>> code that makes sure that no NULL 'fnd' is passed.
>>
>> So, remove the useless test.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Seems correct, thanks.
> 
> Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
> 
>> ---
>>  fs/ntfs3/index.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
>> index 4f71a91f07d9..6f81e3a49abf 100644
>> --- a/fs/ntfs3/index.c
>> +++ b/fs/ntfs3/index.c
>> @@ -1072,9 +1072,7 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni,
>>  	if (!e)
>>  		return -EINVAL;
>>  
>> -	if (fnd)
>> -		fnd->root_de = e;
>> -
>> +	fnd->root_de = e;
>>  	err = 0;
>>  
>>  	for (;;) {
>> -- 
>> 2.30.2
>>

Thanks for work - applied!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-23 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 19:56 [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Christophe JAILLET
2021-09-18 19:56 ` [PATCH 2/2] fs/ntfs3: Remove a useless shadowing variable Christophe JAILLET
2021-09-21 21:41   ` Kari Argillander
2021-09-21 21:39 ` [PATCH 1/2] fs/ntfs3: Remove a useless test in 'indx_find()' Kari Argillander
2021-09-23 16:11   ` Konstantin Komarov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.