From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [QUESTION] staging/easycap fix
Date: Mon, 13 Feb 2012 22:26:33 -0800 [thread overview]
Message-ID: <20120214062633.GA1707@kroah.com> (raw)
In-Reply-To: <CAJKgH8DidbeC=8HZQie9MY-wJKrPUz-1CGjkuNLLcyCfjbqynQ@mail.gmail.com>
On Tue, Feb 14, 2012 at 11:29:54AM +0530, Manavendra Nath Manav wrote:
> 2012/2/14 Ezequiel Garc?a <elezegarcia@gmail.com>:
> > El d?a 14 de febrero de 2012 02:06, Greg KH <greg@kroah.com> escribi?:
> >> On Tue, Feb 14, 2012 at 01:47:52AM -0300, Ezequiel Garc?a wrote:
> >>> 2. second, I am fixing some style issues (besides checkpatch), for
> >>> instance "if" syntax:
> >>>
> >>> - ? if (0 == bInterfaceNumber) {
> >>> + ? if (bInterfaceNumber == 0) {
> >>
> >> You do know why the first style was chosen, right?
> >
> > This driver code has this "if" style on every if clause. Perhaps
> > author's taste? Don't know.
> > Searching at kernel code I haven't seen this kind of "if" style.
> >
>
> This particular "if" style is recommended because it prevents the
> accidental "always true if condition" in case when the coder
> accidentally types "=" instead of "==". "if (0 = x)" can always save
> you instead of "if (x = 0)" from nasty typo bugs. Though compiler
> warns about it with -Wall flag.
It's only "recommended" if you have a compiler that doesn't check for
such foolish things.
Luckily we do, so you don't have to write kernel code like this at all,
so while cleaning it up would be "nice to have", it's not essencial to
get it out of the staging tree at all.
thanks,
greg k-h
next prev parent reply other threads:[~2012-02-14 6:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CALF0-+UdbqOnQ6ZT0bPiMVCTFWwMQss6XrFqNL6xsugRPVX_qw@mail.gmail.com>
2012-02-14 4:47 ` [QUESTION] staging/easycap fix Ezequiel García
2012-02-14 5:06 ` Greg KH
2012-02-14 5:30 ` Ezequiel García
2012-02-14 5:59 ` Manavendra Nath Manav
2012-02-14 6:26 ` Greg KH [this message]
2012-02-14 22:01 ` Ezequiel García
2012-02-14 22:39 ` Greg KH
2012-02-15 14:14 ` Peter Senna Tschudin
2012-02-16 12:57 ` Ezequiel García
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=20120214062633.GA1707@kroah.com \
--to=greg@kroah.com \
--cc=kernelnewbies@lists.kernelnewbies.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).