Messages in this thread | | | Subject | Re: [PATCH 1/3] staging: r8188eu: remove _io_ops structure | From | Pavel Skripkin <> | Date | Mon, 6 Sep 2021 17:04:42 +0300 |
| |
On 9/6/21 10:49 AM, Dan Carpenter wrote: > On Sat, Sep 04, 2021 at 05:04:45PM +0200, Fabio M. De Francesco wrote: >> -static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata) >> +int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *pdata) >> { >> + struct io_priv *pio_priv = &adapter->iopriv; >> + struct intf_hdl *pintfhdl = &pio_priv->intf; >> u16 wvalue = (u16)(addr & 0x0000ffff); >> u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0}; >> + int ret; >> >> if (length > VENDOR_CMD_MAX_DATA_LEN) >> return -EINVAL; > > The caller treats this negative return as success. >
Oh, good catch, thank you so much for pointing it out... This driver uses unusual approach for error handling with private _SUCCESS and _FAIL macros and I forgot to call RTW_ERROR_CODE :(
>> >> memcpy(buf, pdata, length); >> + ret = usbctrl_vendorreq(pintfhdl, wvalue, buf, (length & 0xffff), REALTEK_USB_VENQT_WRITE); >> >> - return usbctrl_vendorreq(pintfhdl, wvalue, buf, (length & 0xffff), REALTEK_USB_VENQT_WRITE); >> + return RTW_STATUS_CODE(ret); >> } > > [ snip ] > > >> -void usb_read_port_cancel(struct intf_hdl *pintfhdl) >> +void rtw_read_port_cancel(struct adapter *adapter) >> { >> int i; >> - struct recv_buf *precvbuf; >> - struct adapter *padapter = pintfhdl->padapter; >> - precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf; >> + struct recv_buf *precvbuf = (struct recv_buf *) adapter->recvpriv.precv_buf; >> >> DBG_88E("%s\n", __func__); >> >> - padapter->bReadPortCancel = true; >> + adapter->bReadPortCancel = true; > > In these functions it would be better to rename "padapter" as "adapter" > in a follow on function. Keep it the same for now just to make review > easier. >
Ok, will bring old name back in v4. Thank you for review :)
With regards, Pavel Skripkin
| |