linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] staging: r8188eu: remove _io_ops structure
Date: Mon, 6 Sep 2021 17:04:42 +0300	[thread overview]
Message-ID: <aec7eb51-721a-d2c1-4eba-c4adbb8265c3@gmail.com> (raw)
In-Reply-To: <20210906074910.GG1957@kadam>

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

  reply	other threads:[~2021-09-06 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 15:04 [PATCH 0/3] staging: r8188eu: Shorten and simplify calls chain Fabio M. De Francesco
2021-09-04 15:04 ` [PATCH 1/3] staging: r8188eu: remove _io_ops structure Fabio M. De Francesco
2021-09-06  7:49   ` Dan Carpenter
2021-09-06 14:04     ` Pavel Skripkin [this message]
2021-09-04 15:04 ` [PATCH 2/3] staging: r8188eu: Shorten calls chain of rtw_read8/16/32() Fabio M. De Francesco
2021-09-04 15:04 ` [PATCH 3/3] staging: r8188eu: Shorten calls chain of rtw_write8/16/32/N() Fabio M. De Francesco
2021-09-04 17:09   ` kernel test robot
2021-09-04 20:41     ` Fabio M. De Francesco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aec7eb51-721a-d2c1-4eba-c4adbb8265c3@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@oracle.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --subject='Re: [PATCH 1/3] staging: r8188eu: remove _io_ops structure' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).