public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |"
@ 2019-06-03 18:54 Hariprasad Kelam
  2019-06-03 19:04 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Hariprasad Kelam @ 2019-06-03 18:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Carmeli Tamir, Nishad Kamdar, devel,
	linux-kernel

Knowing the fact that operator '|' is faster than '+'.
Its better we replace + with | in this case.

Issue reported by coccicheck
drivers/staging/emxx_udc/emxx_udc.h:94:34-35: WARNING: sum of probable
bitmasks, consider |

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h
index b8c3dee..88d6bda 100644
--- a/drivers/staging/emxx_udc/emxx_udc.h
+++ b/drivers/staging/emxx_udc/emxx_udc.h
@@ -91,7 +91,7 @@ int vbus_irq;
 #define BIT30		0x40000000
 #define BIT31		0x80000000
 
-#define TEST_FORCE_ENABLE		(BIT18 + BIT16)
+#define TEST_FORCE_ENABLE		(BIT18 | BIT16)
 
 #define INT_SEL				BIT10
 #define CONSTFS				BIT09
-- 
2.7.4


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

* Re: [PATCH] Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |"
  2019-06-03 18:54 [PATCH] Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |" Hariprasad Kelam
@ 2019-06-03 19:04 ` Greg Kroah-Hartman
  2019-06-05  6:34   ` Hariprasad Kelam
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-03 19:04 UTC (permalink / raw)
  To: Hariprasad Kelam; +Cc: Carmeli Tamir, Nishad Kamdar, devel, linux-kernel

On Tue, Jun 04, 2019 at 12:24:12AM +0530, Hariprasad Kelam wrote:
> Knowing the fact that operator '|' is faster than '+'.
> Its better we replace + with | in this case.
> 
> Issue reported by coccicheck
> drivers/staging/emxx_udc/emxx_udc.h:94:34-35: WARNING: sum of probable
> bitmasks, consider |
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  drivers/staging/emxx_udc/emxx_udc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h
> index b8c3dee..88d6bda 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.h
> +++ b/drivers/staging/emxx_udc/emxx_udc.h
> @@ -91,7 +91,7 @@ int vbus_irq;
>  #define BIT30		0x40000000
>  #define BIT31		0x80000000

All of those BITXX defines should be removed and the "real" BIT(X) macro
used instead.

> -#define TEST_FORCE_ENABLE		(BIT18 + BIT16)
> +#define TEST_FORCE_ENABLE		(BIT18 | BIT16)

It really doesn't matter, a good compiler will have already turned this
into a constant value so you really do not know if this is less/faster
code or not, right?

Did you look at the output to verify this actually changed anything?

thanks,

greg k-h

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

* Re: [PATCH] Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |"
  2019-06-03 19:04 ` Greg Kroah-Hartman
@ 2019-06-05  6:34   ` Hariprasad Kelam
  2019-06-06 10:51     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Hariprasad Kelam @ 2019-06-05  6:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Carmeli Tamir, Nishad Kamdar, devel,
	linux-kernel

On Mon, Jun 03, 2019 at 09:04:57PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Jun 04, 2019 at 12:24:12AM +0530, Hariprasad Kelam wrote:
> > Knowing the fact that operator '|' is faster than '+'.
> > Its better we replace + with | in this case.
> > 
> > Issue reported by coccicheck
> > drivers/staging/emxx_udc/emxx_udc.h:94:34-35: WARNING: sum of probable
> > bitmasks, consider |
> > 
> > Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> > ---
> >  drivers/staging/emxx_udc/emxx_udc.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h
> > index b8c3dee..88d6bda 100644
> > --- a/drivers/staging/emxx_udc/emxx_udc.h
> > +++ b/drivers/staging/emxx_udc/emxx_udc.h
> > @@ -91,7 +91,7 @@ int vbus_irq;
> >  #define BIT30		0x40000000
> >  #define BIT31		0x80000000
> 
> All of those BITXX defines should be removed and the "real" BIT(X) macro
> used instead.
Yes will send separate patch  to address this.
> 
> > -#define TEST_FORCE_ENABLE		(BIT18 + BIT16)
> > +#define TEST_FORCE_ENABLE		(BIT18 | BIT16)
> 
> It really doesn't matter, a good compiler will have already turned this
> into a constant value so you really do not know if this is less/faster
> code or not, right?
> 
> Did you look at the output to verify this actually changed anything?
> 
> thanks,
> 
> greg k-h

Ok . Treating this as false postive from coccicheck.

Thanks,
Hariprasad k

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

* Re: [PATCH] Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |"
  2019-06-05  6:34   ` Hariprasad Kelam
@ 2019-06-06 10:51     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-06-06 10:51 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: Greg Kroah-Hartman, Carmeli Tamir, Nishad Kamdar, devel,
	linux-kernel

On Wed, Jun 05, 2019 at 12:04:43PM +0530, Hariprasad Kelam wrote:
> On Mon, Jun 03, 2019 at 09:04:57PM +0200, Greg Kroah-Hartman wrote:
> > On Tue, Jun 04, 2019 at 12:24:12AM +0530, Hariprasad Kelam wrote:
> > > Knowing the fact that operator '|' is faster than '+'.
> > > Its better we replace + with | in this case.
> > > 
> > > Issue reported by coccicheck
> > > drivers/staging/emxx_udc/emxx_udc.h:94:34-35: WARNING: sum of probable
> > > bitmasks, consider |
> > > 
> > > Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> > > ---
> > >  drivers/staging/emxx_udc/emxx_udc.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h
> > > index b8c3dee..88d6bda 100644
> > > --- a/drivers/staging/emxx_udc/emxx_udc.h
> > > +++ b/drivers/staging/emxx_udc/emxx_udc.h
> > > @@ -91,7 +91,7 @@ int vbus_irq;
> > >  #define BIT30		0x40000000
> > >  #define BIT31		0x80000000
> > 
> > All of those BITXX defines should be removed and the "real" BIT(X) macro
> > used instead.
> Yes will send separate patch  to address this.
> > 
> > > -#define TEST_FORCE_ENABLE		(BIT18 + BIT16)
> > > +#define TEST_FORCE_ENABLE		(BIT18 | BIT16)
> > 
> > It really doesn't matter, a good compiler will have already turned this
> > into a constant value so you really do not know if this is less/faster
> > code or not, right?
> > 
> > Did you look at the output to verify this actually changed anything?
> > 
> > thanks,
> > 
> > greg k-h
> 
> Ok . Treating this as false postive from coccicheck.

I liked the patch.  | is way more normal and readable than +.  It's just
the commit message was bogus.

I would be very surprised if this coccicheck found anything that wasn't
a compile time constant like this.

regards,
dan carpenter


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

end of thread, other threads:[~2019-06-06 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-03 18:54 [PATCH] Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |" Hariprasad Kelam
2019-06-03 19:04 ` Greg Kroah-Hartman
2019-06-05  6:34   ` Hariprasad Kelam
2019-06-06 10:51     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox