Re: [PATCH v2 1/3] staging: rtl8712: Remove boolean comparisons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 19, 2015 at 06:14:29PM +0100, Luis de Bethencourt wrote:
> Boolean tests do not need explicit comparison to true or false.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@xxxxxxxxxxxxxxx>
> ---
> diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
> index c940722..e33eeed 100644
> --- a/drivers/staging/rtl8712/usb_ops_linux.c
> +++ b/drivers/staging/rtl8712/usb_ops_linux.c
> @@ -266,7 +266,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
>  	if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
>  	    adapter->pwrctrlpriv.pnp_bstop_trx)
>  		return _FAIL;
> -	if (!precvbuf->reuse == false || !precvbuf->pskb) {
> +	if (precvbuf->reuse || !precvbuf->pskb) {
>  		precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
>  		if (precvbuf->pskb != NULL)
>  			precvbuf->reuse = true;

You have transformed this faithfully, but my instinct says that the
original code is wrong.  It should be:

	if (!precvbuf->reuse || !precvbuf->pskb) {

I checked and usb_read_port() is implemented this way in
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c.  Again I am going on
instinct and not a full understanding of the code, but I'm probably
correct.

Anyway, this is not related to the patch so we should fix it in a later
patch, but let's not forget.

TODO: rtl8712: fix a reversed condition in r8712_usb_read_port()

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux