Skip to contentSkip to conversation

usb: host: ohci-pxa27x: Fix and & vs | typo

PATCH In review Dan Carpenter 3 participants 5 messages Feb 23, 2018 – Aug 17, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: host: ohci-pxa27x: Fix and & vs | typo

The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's a no-op because of the & vs | typo. This bug predates git and it was only discovered using static analysis so it must not affect too many people in real life.

---
Not tested.

drivers/usb/host/ohci-pxa27x.c +1 -1
index 3e2474959735..7679fb583e41 100644
@@ -148,7 +148,7 @@ static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci, int mode)
 		uhcrhda |= RH_A_NPS;
 		break;
 	case PMM_GLOBAL_MODE:
-		uhcrhda &= ~(RH_A_NPS & RH_A_PSM);
+		uhcrhda &= ~(RH_A_NPS | RH_A_PSM);
 		break;
 	case PMM_PERPORT_MODE:
 		uhcrhda &= ~(RH_A_NPS);
#1 lore raw

I was looking at this code again today and I'm still convinced this patch is correct. Should I resend?

regards,
dan carpenter

Quoted 26 lines · Dan Carpenter

The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's a no-op because of the & vs | typo. This bug predates git and it was only discovered using static analysis so it must not affect too many people in real life.

---
Not tested.

drivers/usb/host/ohci-pxa27x.c +1 -2
index 3e2474959735..7679fb583e41 100644
@@ -148,7 +148,7 @@ static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci, int mode)
 		uhcrhda |= RH_A_NPS;
 		break;
 	case PMM_GLOBAL_MODE:
-		uhcrhda &= ~(RH_A_NPS & RH_A_PSM);
+		uhcrhda &= ~(RH_A_NPS | RH_A_PSM);
 		break;
 	case PMM_PERPORT_MODE:
 		uhcrhda &= ~(RH_A_NPS);
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Acked-by
#2 lore raw
Quoted 16 lines · Dan Carpenter

I was looking at this code again today and I'm still convinced this patch is correct. Should I resend?

regards,
dan carpenter

Quoted 9 lines · Dan Carpenter

The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's a no-op because of the & vs | typo. This bug predates git and it was only discovered using static analysis so it must not affect too many people in real life.

---
Not tested.

Quoted 13 lines

drivers/usb/host/ohci-pxa27x.c static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci, int mode) · line 154

Quoted 13 lines
drivers/usb/host/ohci-pxa27x.c +1 -1
index 3e2474959735..7679fb583e41 100644
@@ -148,7 +148,7 @@ static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci, int mode)
 		uhcrhda |= RH_A_NPS;
 		break;
 	case PMM_GLOBAL_MODE:
-		uhcrhda &= ~(RH_A_NPS & RH_A_PSM);
+		uhcrhda &= ~(RH_A_NPS | RH_A_PSM);
 		break;
 	case PMM_PERPORT_MODE:
 		uhcrhda &= ~(RH_A_NPS);

The patch sure looks right to me. FWIW:

Alan Stern

#3 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

I was looking at this code again today and I'm still convinced this patch is correct. Should I resend?

Please resend, it's not in my queue anywhere :(

#4 lore raw

PATCH 1/1 usb: host: ohci-pxa27x: Fix and & vs | typo

The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's a no-op because of the & vs | typo. This bug predates git and it was only discovered using static analysis so it must not affect too many people in real life.

---
 drivers/usb/host/ohci-pxa27x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-pxa27x.c +1 -1
index 3e2474959735..7679fb583e41 100644
@@ -148,7 +148,7 @@ static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci, int mode)
 		uhcrhda |= RH_A_NPS;
 		break;
 	case PMM_GLOBAL_MODE:
-		uhcrhda &= ~(RH_A_NPS & RH_A_PSM);
+		uhcrhda &= ~(RH_A_NPS | RH_A_PSM);
 		break;
 	case PMM_PERPORT_MODE:
 		uhcrhda &= ~(RH_A_NPS);
Signature · 1 line
2.20.1