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

Dan Carpenter dan.carpenter at oracle.com
Thu Oct 22 19:05:24 UTC 2015


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 at osg.samsung.com>
> ---
> 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


More information about the devel mailing list