diff options
author | Martin Kaiser <martin@kaiser.cx> | 2021-08-21 18:48:57 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-08-26 12:17:01 +0200 |
commit | 22d0d6104e4d6c7d86ade11888422762db15ab75 (patch) | |
tree | e89b8f78ca759d56883f6f08687c887e4053664b /drivers | |
parent | e8baed3c765e0f88f4107c52a3505f52d174b41f (diff) |
staging: r8188eu: clean up the usb_writeN
Remove unnecessary variables, check the length.
Acked-by: Michael Straube <straube.linux@gmail.com>
Acked-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20210821164859.4351-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/r8188eu/hal/usb_ops_linux.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index e01f1ac19596..5408383ccec3 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -151,20 +151,15 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata) { - u16 wvalue; - u16 len; + u16 wvalue = (u16)(addr & 0x0000ffff); u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0}; - int ret; - + if (length > VENDOR_CMD_MAX_DATA_LEN) + return -EINVAL; - wvalue = (u16)(addr & 0x0000ffff); - len = length; - memcpy(buf, pdata, len); + memcpy(buf, pdata, length); - ret = usbctrl_vendorreq(pintfhdl, wvalue, buf, len, REALTEK_USB_VENQT_WRITE); - - return ret; + return usbctrl_vendorreq(pintfhdl, wvalue, buf, (length & 0xffff), REALTEK_USB_VENQT_WRITE); } static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf) |