From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jake Champlin <jake.champlin.27@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: csr: csr_msgconv: Fixed Multiple Coding Style Issues
Date: Sat, 26 Jan 2013 23:35:12 +0300 [thread overview]
Message-ID: <20130126203512.GD4584@mwanda> (raw)
In-Reply-To: <20130126201431.GA18436@gmail.com>
On Sat, Jan 26, 2013 at 03:14:35PM -0500, Jake Champlin wrote:
> Resolved 150 Style Errors and 202 Coding Style Warnings.
>
Normally we would prefer that these are broken up into a several
different patches that each fix one type of style issue.
[patch 1/x] csr: csr_msgconv: use tab indents
[patch 2/x] csr: csr_msgconv: put curly braces on the right line
etc...
> + CsrMsgConvPrimEntry *ptr = NULL;
> +
> + if (converter) {
> + ptr = converter->profile_converters;
> + while (ptr) {
> + if (ptr->primType == primType)
> + break;
> + else
> + ptr = ptr->next;
> + }
> + }
The while loop should be indented one more time.
> + if (ptr) {
> + const CsrMsgConvMsgEntry *cv;
> + u16 msgId = 0;
> + size_t offset = 0;
> + CsrUint16Des(&msgId, data, &offset);
> +
> + cv = find_msg_converter(ptr, msgId);
> + if (cv)
> + ret = cv->deserFunc(data, length);
> + else
> + ret = NULL;
> + } else
> + ret = NULL;
> +
It should be:
+
+ ret = NULL;
+ } else {
+ ret = NULL;
+ }
The rules on braces are a little bit complicated. If it's one line
then don't use braces. If it's two lines and you don't *need* to
use braces then still use braces.
if (foo) {
/* some comment */
frob();
}
If either side of the if else statement uses braces then use braces
on both.
> + if (ptr) {
> + const CsrMsgConvMsgEntry *cv;
> + u16 msgId = *(u16 *) data;
> +
> + cv = find_msg_converter(ptr, msgId);
> + if (cv) {
> + cv->freeFunc(data);
> + ret = TRUE;
> + } else
> + ret = FALSE;
> + } else
> + ret = FALSE;
> +
??
regards,
dan carpenter
next prev parent reply other threads:[~2013-01-26 20:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-26 20:14 [PATCH] Staging: csr: csr_msgconv: Fixed Multiple Coding Style Issues Jake Champlin
2013-01-26 20:35 ` Dan Carpenter [this message]
2013-01-26 20:41 ` jake.champlin.27
-- strict thread matches above, loose matches on Subject: below --
2013-01-26 22:06 Jake Champlin
2013-01-30 4:24 ` Greg KH
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=20130126203512.GD4584@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jake.champlin.27@gmail.com \
--cc=linux-kernel@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