From: Brian W Hart <hartb@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] Fix coding style errors
Date: Fri, 31 Jan 2014 13:34:53 -0600 [thread overview]
Message-ID: <20140131193451.GA23880@oc3347516403.ibm.com> (raw)
In-Reply-To: <1390878454-4329-1-git-send-email-stewartb2@gmail.com>
On Mon, Jan 27, 2014 at 09:07:34PM -0600, Brandon Stewart wrote:
> I corrected several coding errors.
>
> Signed-off-by: Brandon Stewart <stewartb2@gmail.com>
> ---
> drivers/macintosh/adb.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
> index 53611de..dd3f49a 100644
> --- a/drivers/macintosh/adb.c
> +++ b/drivers/macintosh/adb.c
> @@ -623,7 +623,7 @@ do_adb_query(struct adb_request *req)
> {
> int ret = -EINVAL;
>
> - switch(req->data[1]) {
> + switch (req->data[1]) {
> case ADB_QUERY_GETDEVINFO:
> if (req->nbytes < 3)
> break;
> @@ -792,8 +792,9 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
> }
> /* Special case for ADB_BUSRESET request, all others are sent to
> the controller */
> - else if ((req->data[0] == ADB_PACKET) && (count > 1)
> - && (req->data[1] == ADB_BUSRESET)) {
> + else if (req->data[0] == ADB_PACKET &&
> + req->data[1] == ADB_BUSRESET &&
> + count > 1) {
Is this re-ordering safe? Isn't 'count > 1' notionally indicating whether
req->data[1] exists to be tested in the first place?
On the other hand there's a check at the top of the routine that returns
if count < 2, so maybe the check here should be removed altogether (along
with one a few lines above)?
prev parent reply other threads:[~2014-01-31 19:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 3:07 [PATCH 2/2] Fix coding style errors Brandon Stewart
2014-01-31 19:34 ` Brian W Hart [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=20140131193451.GA23880@oc3347516403.ibm.com \
--to=hartb@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.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).