Re: [RFC/PATCH 1/1] mmc: block: Add MMC write packing statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux