[PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions
Zang Roy-R61911
r61911 at freescale.com
Thu Oct 14 22:15:20 EDT 2010
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, October 15, 2010 0:01 AM
> To: Zang Roy-R61911
> Cc: Wood Scott-B07421; Anton Vorontsov; linux-mtd at lists.infradead.org;
> dwmw2 at infradead.org; dedekind1 at gmail.com; akpm at linux-foundation.org;
Lan
> Chunhe-B25806; Gala Kumar-B11780; linuxppc-dev at ozlabs.org; Hu
Mingkai-B21284
> Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver
detect nand
> flash partitions
>
> On Wed, 13 Oct 2010 20:09:02 -0700
> "Zang Roy-R61911" <r61911 at freescale.com> wrote:
>
> > > > > > + struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = NULL;
> > > > >
> > > > > No need for = NULL.
> > > > Any harm? Or just personal habit or style? Can you explain about
> > why?
> > >
> > > Besides not wanting superfluous code on general principle, it
could
> > > hide a bug if in the future the real initialization is missing on
some
> > > code path. It would become a runtime NULL dereference rather than
a
> > > compiler warning.
> >
> > Not exactly.
> > Per my understand, if the pointer will definitely be assigned in
code
> > path,
> > it is not necessary to init it when define. for example,
> >
> > char c;
> > char b;
> > char *a;
> > if (condition)
> > a = &c;
> > else
> > a = &b;
> > ...
> >
> > for other case, if the path will not ensure the pointer assignment,
it
> > will be inited
> > when define to avoid warning. for example,
> >
> > char c;
> > char *a = NULL;
> > if (condition)
> > a = &c;
> > ...
>
> Yes, but this patch looks like the former case, not the
> latter.
That is right.
> Is GCC giving a warning without the initializer?
no.
we are on the same point.
Thanks.
Roy
More information about the linux-mtd
mailing list