Skip to content

Commit fb945c9

Browse files
andy-shevLee Jones
authored andcommitted
mfd: dln2: Fix sanity checking for endpoints
While the commit 2b8bd60 ("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. While here, introduce an enumerator for magic values to prevent similar issue to happen in the future. Fixes: 2b8bd60 ("mfd: dln2: More sanity checking for endpoints") Cc: Oliver Neukum <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 4e213b4 commit fb945c9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/mfd/dln2.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ struct dln2_mod_rx_slots {
9090
spinlock_t lock;
9191
};
9292

93+
enum dln2_endpoint {
94+
DLN2_EP_OUT = 0,
95+
DLN2_EP_IN = 1,
96+
};
97+
9398
struct dln2_dev {
9499
struct usb_device *usb_dev;
95100
struct usb_interface *interface;
@@ -733,10 +738,10 @@ static int dln2_probe(struct usb_interface *interface,
733738
hostif->desc.bNumEndpoints < 2)
734739
return -ENODEV;
735740

736-
epin = &hostif->endpoint[0].desc;
737-
epout = &hostif->endpoint[1].desc;
741+
epout = &hostif->endpoint[DLN2_EP_OUT].desc;
738742
if (!usb_endpoint_is_bulk_out(epout))
739743
return -ENODEV;
744+
epin = &hostif->endpoint[DLN2_EP_IN].desc;
740745
if (!usb_endpoint_is_bulk_in(epin))
741746
return -ENODEV;
742747

0 commit comments

Comments
 (0)