lkml.org 
[lkml]   [2015]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] staging: rtl8712: Remove boolean comparisons
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@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


\
 
 \ /
  Last update: 2015-10-22 21:21    [W:0.087 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site