From: David Brown <davidb@codeaurora.org>
To: Rahul Bedarkar <rpal143@gmail.com>
Cc: Maya Erez <merez@codeaurora.org>,
linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC/PATCH 1/1] mmc: block: Add MMC write packing statistics
Date: Wed, 6 Jun 2012 09:56:51 -0700 [thread overview]
Message-ID: <20120606165651.GA15102@codeaurora.org> (raw)
In-Reply-To: <CA+NV+VknemgROF5DsSVJ8MDUEyMnrM_vtj66nUTKP6ZvxsF+ag@mail.gmail.com>
On Wed, Jun 06, 2012 at 12:02:10PM +0530, Rahul Bedarkar wrote:
> > +static ssize_t mmc_wr_pack_stats_read(struct file *filp, char __user *ubuf,
> > + size_t cnt, loff_t *ppos)
> > +{
> > + struct mmc_card *card = filp->private_data;
> > + struct mmc_wr_pack_stats *pack_stats;
> > + int i;
> Best practice is to initialize variables at the time of declaration,
> even if you initialize it before using. Many times we forget to do
> that and there could be logical errors.
gcc will often emit a warning if a variable is used before
initialization. There seems to be a trend amongst kernel developers
to eschew redundant initializations, since they do actually generate
code. In fact, there is a macro 'uninitialized_var(x)' to suppress
the warning from the compiler when it is incorrect, so that a variable
doesn't have to be initialized when not really needed.
Outside of the kernel, though, I would otherwise agree with you.
David
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next prev parent reply other threads:[~2012-06-06 16:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 6:16 [RFC/PATCH 0/1] Add MMC write packing statistics Maya Erez
2012-06-06 6:16 ` [RFC/PATCH 1/1] mmc: block: " Maya Erez
2012-06-06 6:32 ` Rahul Bedarkar
2012-06-06 16:56 ` David Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-06-06 20:56 merez
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=20120606165651.GA15102@codeaurora.org \
--to=davidb@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=merez@codeaurora.org \
--cc=rpal143@gmail.com \
/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).