mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2024-11-22 13:35:00 +00:00
clean up the usb_writeN
Remove unnecessary variables, check the length. Link: https://lore.kernel.org/r/20210821164859.4351-8-martin@kaiser.cx
This commit is contained in:
parent
fe504c75a2
commit
d4dcb38048
@ -414,24 +414,15 @@ int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
||||
|
||||
int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
|
||||
{
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
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;
|
||||
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
memcpy(buf, pdata, length);
|
||||
return usbctrl_vendorreq(pintfhdl, wvalue, 0, buf, (length & 0xffff), VENDOR_WRITE);
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = length;
|
||||
_rtw_memcpy(buf, pdata, len);
|
||||
ret = usbctrl_vendorreq(pintfhdl, wvalue, index, buf, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void usb_set_intf_ops(_adapter *padapter, struct _io_ops *pops)
|
||||
|
Loading…
Reference in New Issue
Block a user