[PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions

Scott Wood scottwood at freescale.com
Thu Oct 14 12:01:18 EDT 2010


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.  Is GCC giving a warning without the initializer?

-Scott




More information about the linux-mtd mailing list