mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
e8baed3c76
commit
22d0d6104e
|
@ -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)
|
static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
|
||||||
{
|
{
|
||||||
u16 wvalue;
|
u16 wvalue = (u16)(addr & 0x0000ffff);
|
||||||
u16 len;
|
|
||||||
u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
|
u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
|
||||||
int ret;
|
|
||||||
|
|
||||||
|
if (length > VENDOR_CMD_MAX_DATA_LEN)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memcpy(buf, pdata, length);
|
||||||
|
|
||||||
wvalue = (u16)(addr & 0x0000ffff);
|
return usbctrl_vendorreq(pintfhdl, wvalue, buf, (length & 0xffff), REALTEK_USB_VENQT_WRITE);
|
||||||
len = length;
|
|
||||||
memcpy(buf, pdata, len);
|
|
||||||
|
|
||||||
ret = usbctrl_vendorreq(pintfhdl, wvalue, buf, len, REALTEK_USB_VENQT_WRITE);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf)
|
static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf)
|
||||||
|
|
Loading…
Reference in New Issue