Skip to contentSkip to conversation

mfd: dln2: Fix sanity checking for endpoints

PATCH Superseded Andy Shevchenko 2 participants 2 messages Feb 18, 2020 – Feb 26, 2020 Multifunction devices (MFD)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: dln2: Fix sanity checking for endpoints

While the commit 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints") tries to harden the sanity checks it made at the same time a regression, i.e. mixed in and out endpoints. Obviously it should have been not tested on real hardware at that time, but unluckily it didn't happen.

So, fix above mentioned typo and make device being enumerated again.

Fixes 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints")
Cc Oliver Neukum <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/mfd/dln2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/dln2.c +2 -2
index 984d6b438aca..3a729b196b1f 100644
@@ -754,8 +754,8 @@ static int dln2_probe(struct usb_interface *interface,
 	    hostif->desc.bNumEndpoints < 2)
 		return -ENODEV;
 
-	epin = &hostif->endpoint[0].desc;
-	epout = &hostif->endpoint[1].desc;
+	epin = &hostif->endpoint[1].desc;
+	epout = &hostif->endpoint[0].desc;
 	if (!usb_endpoint_is_bulk_out(epout))
 		return -ENODEV;
 	if (!usb_endpoint_is_bulk_in(epin))
Signature · 1 line
2.25.0
#1 lore raw
Quoted 4 lines · Andy Shevchenko

While the commit 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints") tries to harden the sanity checks it made at the same time a regression, i.e. mixed in and out endpoints. Obviously it should have been not tested on real hardware at that time, but unluckily it didn't happen.

This is why I usually insist on defining magic numbers.

That would be a better solution I feel.

Quoted 25 lines

So, fix above mentioned typo and make device being enumerated again.

Fixes 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints")
Cc Oliver Neukum <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/mfd/dln2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/dln2.c +2 -2
index 984d6b438aca..3a729b196b1f 100644
@@ -754,8 +754,8 @@ static int dln2_probe(struct usb_interface *interface,
 	    hostif->desc.bNumEndpoints < 2)
 		return -ENODEV;
 
-	epin = &hostif->endpoint[0].desc;
-	epout = &hostif->endpoint[1].desc;
+	epin = &hostif->endpoint[1].desc;
+	epout = &hostif->endpoint[0].desc;
 	if (!usb_endpoint_is_bulk_out(epout))
 		return -ENODEV;
 	if (!usb_endpoint_is_bulk_in(epin))
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog