71
71
#define MSR_SPEED (1<<3)
72
72
#define MSR_LINK (1<<2)
73
73
74
+ /* USB endpoints */
75
+ enum rtl8150_usb_ep {
76
+ RTL8150_USB_EP_CONTROL = 0 ,
77
+ RTL8150_USB_EP_BULK_IN = 1 ,
78
+ RTL8150_USB_EP_BULK_OUT = 2 ,
79
+ RTL8150_USB_EP_INT_IN = 3 ,
80
+ };
81
+
74
82
/* Interrupt pipe data */
75
83
#define INT_TSR 0x00
76
84
#define INT_RSR 0x01
@@ -867,6 +875,13 @@ static int rtl8150_probe(struct usb_interface *intf,
867
875
struct usb_device * udev = interface_to_usbdev (intf );
868
876
rtl8150_t * dev ;
869
877
struct net_device * netdev ;
878
+ static const u8 bulk_ep_addr [] = {
879
+ RTL8150_USB_EP_BULK_IN | USB_DIR_IN ,
880
+ RTL8150_USB_EP_BULK_OUT | USB_DIR_OUT ,
881
+ 0 };
882
+ static const u8 int_ep_addr [] = {
883
+ RTL8150_USB_EP_INT_IN | USB_DIR_IN ,
884
+ 0 };
870
885
871
886
netdev = alloc_etherdev (sizeof (rtl8150_t ));
872
887
if (!netdev )
@@ -880,6 +895,13 @@ static int rtl8150_probe(struct usb_interface *intf,
880
895
return - ENOMEM ;
881
896
}
882
897
898
+ /* Verify that all required endpoints are present */
899
+ if (!usb_check_bulk_endpoints (intf , bulk_ep_addr ) ||
900
+ !usb_check_int_endpoints (intf , int_ep_addr )) {
901
+ dev_err (& intf -> dev , "couldn't find required endpoints\n" );
902
+ goto out ;
903
+ }
904
+
883
905
tasklet_setup (& dev -> tl , rx_fixup );
884
906
spin_lock_init (& dev -> rx_pool_lock );
885
907
0 commit comments