Message ID | 20221008120211.24764-1-pchelkin@ispras.ru (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Toke Høiland-Jørgensen |
Headers | show |
Series | [v4] ath9k: verify the expected usb_endpoints are present | expand |
On Sat, 2022-10-08 at 15:02 +0300, Fedor Pchelkin wrote: > > + /* Verify the expected endpoints are present */ > + alt = interface->cur_altsetting; > + if (usb_find_common_endpoints(alt, &bulk_in, &bulk_out, &int_in, &int_out) < 0 || > + usb_endpoint_num(bulk_in) != USB_WLAN_RX_PIPE || > + usb_endpoint_num(bulk_out) != USB_WLAN_TX_PIPE || > + usb_endpoint_num(int_in) != USB_REG_IN_PIPE || > + usb_endpoint_num(int_out) != USB_REG_OUT_PIPE) { > + dev_err(&udev->dev, > + "ath9k_htc: Device endpoint numbers are not the expected ones\n"); > + return -ENODEV; > Indentation somehow got pretty messed up now .. johannes
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 4d9002a9d082..b359a9d382e2 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -1329,10 +1329,24 @@ static int send_eject_command(struct usb_interface *interface) static int ath9k_hif_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) { + struct usb_endpoint_descriptor *bulk_in, *bulk_out, *int_in, *int_out; struct usb_device *udev = interface_to_usbdev(interface); + struct usb_host_interface *alt; struct hif_device_usb *hif_dev; int ret = 0; + /* Verify the expected endpoints are present */ + alt = interface->cur_altsetting; + if (usb_find_common_endpoints(alt, &bulk_in, &bulk_out, &int_in, &int_out) < 0 || + usb_endpoint_num(bulk_in) != USB_WLAN_RX_PIPE || + usb_endpoint_num(bulk_out) != USB_WLAN_TX_PIPE || + usb_endpoint_num(int_in) != USB_REG_IN_PIPE || + usb_endpoint_num(int_out) != USB_REG_OUT_PIPE) { + dev_err(&udev->dev, + "ath9k_htc: Device endpoint numbers are not the expected ones\n"); + return -ENODEV; + } + if (id->driver_info == STORAGE_DEVICE) return send_eject_command(interface);