diff mbox series

[01/21] bcachefs: remove dead code in is_aligned

Message ID 20250128163859.1883260-2-agruenba@redhat.com (mailing list archive)
State New
Headers show
Series bcachefs: eytzinger code | expand

Commit Message

Andreas Gruenbacher Jan. 28, 2025, 4:38 p.m. UTC
This statement does nothing.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/bcachefs/eytzinger.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Eric Herman Jan. 29, 2025, 10:22 a.m. UTC | #1
Hello Andreas,

On 2025-01-28 17:38, Andreas Gruenbacher wrote:
> This statement does nothing.

I would suggest this statement does nothing only in the case of #ifndef 
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.

In the case where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS _is_ defined, 
it tells the compiler that it should not emit a warning for an unused 
parameter.

Perhaps it should be moved in to an #else of the #ifndef in order to 
more clearly communicate that it is expected and okay to ignore this 
parameter in this case.

Cheers,
-Eric

>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>   fs/bcachefs/eytzinger.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c
> index 2eaffe37b5e7..c0fdfe909cf2 100644
> --- a/fs/bcachefs/eytzinger.c
> +++ b/fs/bcachefs/eytzinger.c
> @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align)
>   {
>   	unsigned char lsbits = (unsigned char)size;
>   
> -	(void)base;
>   #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
>   	lsbits |= (unsigned char)(uintptr_t)base;
>   #endif
Andreas Gruenbacher Jan. 29, 2025, 1:19 p.m. UTC | #2
On Wed, Jan 29, 2025 at 11:32 AM Eric Herman <eric@commonscaretakers.com> wrote:
> Hello Andreas,
>
> On 2025-01-28 17:38, Andreas Gruenbacher wrote:
> > This statement does nothing.
>
> I would suggest this statement does nothing only in the case of #ifndef
> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
>
> In the case where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS _is_ defined,
> it tells the compiler that it should not emit a warning for an unused
> parameter.
>
> Perhaps it should be moved in to an #else of the #ifndef in order to
> more clearly communicate that it is expected and okay to ignore this
> parameter in this case.

How about declaring base __maybe_unused?

Thanks,
Andreas

> Cheers,
> -Eric
>
> >
> > Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> > ---
> >   fs/bcachefs/eytzinger.c | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c
> > index 2eaffe37b5e7..c0fdfe909cf2 100644
> > --- a/fs/bcachefs/eytzinger.c
> > +++ b/fs/bcachefs/eytzinger.c
> > @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align)
> >   {
> >       unsigned char lsbits = (unsigned char)size;
> >
> > -     (void)base;
> >   #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
> >       lsbits |= (unsigned char)(uintptr_t)base;
> >   #endif
>
Eric Herman Jan. 30, 2025, 8:23 a.m. UTC | #3
Hello Andreas,

On 2025-01-29 14:19, Andreas Gruenbacher wrote:
> On Wed, Jan 29, 2025 at 11:32 AM Eric Herman <eric@commonscaretakers.com> wrote:
>> Hello Andreas,
>>
>> On 2025-01-28 17:38, Andreas Gruenbacher wrote:
>>> This statement does nothing.
>> I would suggest this statement does nothing only in the case of #ifndef
>> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
>>
>> In the case where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS _is_ defined,
>> it tells the compiler that it should not emit a warning for an unused
>> parameter.
>>
>> Perhaps it should be moved in to an #else of the #ifndef in order to
>> more clearly communicate that it is expected and okay to ignore this
>> parameter in this case.
> How about declaring base __maybe_unused?

Yes, that would be better.

Cheers,

-Eric


>
> Thanks,
> Andreas
>
>> Cheers,
>> -Eric
>>
>>> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
>>> ---
>>>    fs/bcachefs/eytzinger.c | 1 -
>>>    1 file changed, 1 deletion(-)
>>>
>>> diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c
>>> index 2eaffe37b5e7..c0fdfe909cf2 100644
>>> --- a/fs/bcachefs/eytzinger.c
>>> +++ b/fs/bcachefs/eytzinger.c
>>> @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align)
>>>    {
>>>        unsigned char lsbits = (unsigned char)size;
>>>
>>> -     (void)base;
>>>    #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
>>>        lsbits |= (unsigned char)(uintptr_t)base;
>>>    #endif
diff mbox series

Patch

diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c
index 2eaffe37b5e7..c0fdfe909cf2 100644
--- a/fs/bcachefs/eytzinger.c
+++ b/fs/bcachefs/eytzinger.c
@@ -20,7 +20,6 @@  static bool is_aligned(const void *base, size_t size, unsigned char align)
 {
 	unsigned char lsbits = (unsigned char)size;
 
-	(void)base;
 #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 	lsbits |= (unsigned char)(uintptr_t)base;
 #endif