summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2021-04-07 19:05:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-08 09:26:32 +0200
commit889ed8b5e374780560d778677ba68e6956204101 (patch)
treec16c0f22f1522542001fa2295d03fe293280b564 /drivers
parentb048a8db29446bbf898c496b228be546c6cdcf21 (diff)
staging: rtl8188eu: set pipe only once
Set the pipe for reading or writing in usbctrl_vendorreq only once. There's no need to set it again for every retry. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20210407170531.29356-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 13d2733b2b1b..f2fa4fb3595f 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -249,18 +249,20 @@ usbctrl_vendorreq(struct adapter *adapt, u16 value, void *pdata, u16 len, u8 req
goto release_mutex;
}
- while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) {
- memset(pIo_buf, 0, len);
+ if (reqtype == REALTEK_USB_VENQT_READ) {
+ pipe = usb_rcvctrlpipe(udev, 0);
+ } else if (reqtype == REALTEK_USB_VENQT_WRITE) {
+ pipe = usb_sndctrlpipe(udev, 0);
+ } else {
+ status = -EINVAL;
+ goto free_buf;
+ }
- if (reqtype == REALTEK_USB_VENQT_READ) {
- pipe = usb_rcvctrlpipe(udev, 0);/* read_in */
- } else if (reqtype == REALTEK_USB_VENQT_WRITE) {
- pipe = usb_sndctrlpipe(udev, 0);/* write_out */
+ while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) {
+ if (reqtype == REALTEK_USB_VENQT_READ)
+ memset(pIo_buf, 0, len);
+ else
memcpy(pIo_buf, pdata, len);
- } else {
- status = -EINVAL;
- goto free_buf;
- }
status = usb_control_msg(udev, pipe, REALTEK_USB_VENQT_CMD_REQ,
reqtype, value, REALTEK_USB_VENQT_CMD_IDX,