linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Korenevsky <ekorenevsky@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v5] USB hub_probe: rework ugly goto-into-compound-statement
Date: Sat, 19 Nov 2016 09:41:12 +0300	[thread overview]
Message-ID: <20161119064112.GA4582@vnote> (raw)
In-Reply-To: <20161114065054.GB29356@kroah.com>

> Ok, I'm going to be really pedantic here and ask that you spell this
> last statement out:
>        if (usb...)
>                 return true;
>        return false;


> 
> Also, the comment should say:
> 	/* If the first endpoint is not interrupt IN, we... */
> 

It's better to inverse the condition and return false:

```
if (!usb...)
        return false;
return true;
```

This is exactly what is said in the comment ("If the first endpoint...
we'd better punt!"). And does not break the composition of the entire
function (all `if` bodies return false, last statement is `return
true`).

-- 
Eugene

      reply	other threads:[~2016-11-19  6:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-13 12:53 [PATCH v5] USB hub_probe: rework ugly goto-into-compound-statement Eugene Korenevsky
2016-11-14  6:49 ` Greg Kroah-Hartman
2016-11-14  6:50 ` Greg Kroah-Hartman
2016-11-19  6:41   ` Eugene Korenevsky [this message]

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=20161119064112.GA4582@vnote \
    --to=ekorenevsky@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).