Skip to contentSkip to conversation

Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |"

PATCH In review Hariprasad Kelam 3 participants 4 messages Jun 3, 2019 – Jun 6, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: emxx_udc: fix warning "sum of probable bitmasks, consider |"

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 |

---
 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.h +1 -1
index b8c3dee..88d6bda 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw
Quoted 17 lines · Hariprasad Kelam

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 |

---
 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.h +0 -0
index b8c3dee..88d6bda 100644

drivers/staging/emxx_udc/emxx_udc.h int vbus_irq; · line 92

Quoted 2 lines
drivers/staging/emxx_udc/emxx_udc.h +0 -0
@@ -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.

drivers/staging/emxx_udc/emxx_udc.h int vbus_irq; · line 94

Quoted 2 lines
drivers/staging/emxx_udc/emxx_udc.h +1 -1
-#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

#2 lore raw
Quoted 13 lines · Greg Kroah-Hartman
Quoted 12 lines · Hariprasad Kelam

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 |

---
 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

drivers/staging/emxx_udc/emxx_udc.h int vbus_irq; · line 92

Quoted 7 lines
drivers/staging/emxx_udc/emxx_udc.h +0 -0
index b8c3dee..88d6bda 100644
@@ -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.

Quoted 8 lines

drivers/staging/emxx_udc/emxx_udc.h int vbus_irq; · line 94

Quoted 3 lines
drivers/staging/emxx_udc/emxx_udc.h +1 -1
-#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?

Quoted 5 lines

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

#3 lore raw
Quoted 33 lines · Hariprasad Kelam
Quoted 13 lines · Greg Kroah-Hartman
Quoted 12 lines · Hariprasad Kelam

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 |

---
 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

drivers/staging/emxx_udc/emxx_udc.h int vbus_irq; · line 92

Quoted 7 lines
drivers/staging/emxx_udc/emxx_udc.h +0 -0
index b8c3dee..88d6bda 100644
@@ -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.

Quoted 8 lines

drivers/staging/emxx_udc/emxx_udc.h int vbus_irq; · line 94

Quoted 3 lines
drivers/staging/emxx_udc/emxx_udc.h +1 -1
-#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?

Quoted 7 lines
Quoted 5 lines

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