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

From: Dan Carpenter
Date: Thu Oct 22 2015 - 15:06:16 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/