All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zang Roy-R61911 <r61911@freescale.com>
To: Wood Scott-B07421 <B07421@freescale.com>
Cc: dedekind1@gmail.com, Hu Mingkai-B21284 <B21284@freescale.com>,
	Lan Chunhe-B25806 <B25806@freescale.com>,
	linuxppc-dev@ozlabs.org, linux-mtd@lists.infradead.org,
	akpm@linux-foundation.org, dwmw2@infradead.org,
	Gala Kumar-B11780 <B11780@freescale.com>
Subject: RE: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions
Date: Thu, 14 Oct 2010 11:09:02 +0800	[thread overview]
Message-ID: <3850A844E6A3854C827AC5C0BEC7B60A2B02B7@zch01exm23.fsl.freescale.net> (raw)
In-Reply-To: <20101004103813.14d04956@udp111988uds.am.freescale.net>



> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Monday, October 04, 2010 23:38 PM
> To: Zang Roy-R61911
> Cc: Anton Vorontsov; linux-mtd@lists.infradead.org;
dwmw2@infradead.org;
> dedekind1@gmail.com; akpm@linux-foundation.org; Lan Chunhe-B25806;
Wood Scott-
> B07421; Gala Kumar-B11780; linuxppc-dev@ozlabs.org
> Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver
detect nand
> flash partitions
>=20
> On Sat, 2 Oct 2010 05:36:27 -0700
> "Zang Roy-R61911" <r61911@freescale.com> wrote:
>=20
> >
> >
> > > -----Original Message-----
> > > From: Anton Vorontsov [mailto:cbouatmailru@gmail.com]
> > > Sent: Monday, September 20, 2010 21:19 PM
> > > To: Zang Roy-R61911
> > > Cc: linux-mtd@lists.infradead.org; dwmw2@infradead.org;
> dedekind1@gmail.com;
> > > akpm@linux-foundation.org; Lan Chunhe-B25806; Wood Scott-B07421;
Gala
> Kumar-
> > > B11780; linuxppc-dev@ozlabs.org
> > > Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver
detect
> nand
> > > flash partitions
> > >
> > > On Fri, Sep 17, 2010 at 03:01:08PM +0800, Roy Zang wrote:
> > > [...]
> > > > +static struct mutex fsl_elbc_nand_mutex;
> > > > +
> > > > +static int __devinit fsl_elbc_nand_probe(struct platform_device
*dev)
> > > >  {
> > > > -	struct fsl_lbc_regs __iomem *lbc =3D ctrl->regs;
> > > > +	struct fsl_lbc_regs __iomem *lbc;
> > > >  	struct fsl_elbc_mtd *priv;
> > > >  	struct resource res;
> > > > +	struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl =3D NULL;
> > >
> > > No need for =3D NULL.
> > Any harm? Or just personal habit or style? Can you explain about
why?
>=20
> 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 =3D &c;
else
	a =3D &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 =3D NULL;
if (condition)
	a =3D &c;
...

Thanks.
Roy

WARNING: multiple messages have this Message-ID (diff)
From: Zang Roy-R61911 <r61911@freescale.com>
To: Wood Scott-B07421 <B07421@freescale.com>
Cc: dedekind1@gmail.com, Hu Mingkai-B21284 <B21284@freescale.com>,
	Lan Chunhe-B25806 <B25806@freescale.com>,
	linuxppc-dev@ozlabs.org, linux-mtd@lists.infradead.org,
	Anton Vorontsov <cbouatmailru@gmail.com>,
	akpm@linux-foundation.org, dwmw2@infradead.org,
	Gala Kumar-B11780 <B11780@freescale.com>
Subject: RE: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions
Date: Thu, 14 Oct 2010 11:09:02 +0800	[thread overview]
Message-ID: <3850A844E6A3854C827AC5C0BEC7B60A2B02B7@zch01exm23.fsl.freescale.net> (raw)
In-Reply-To: <20101004103813.14d04956@udp111988uds.am.freescale.net>



> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Monday, October 04, 2010 23:38 PM
> To: Zang Roy-R61911
> Cc: Anton Vorontsov; linux-mtd@lists.infradead.org;
dwmw2@infradead.org;
> dedekind1@gmail.com; akpm@linux-foundation.org; Lan Chunhe-B25806;
Wood Scott-
> B07421; Gala Kumar-B11780; linuxppc-dev@ozlabs.org
> Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver
detect nand
> flash partitions
> 
> On Sat, 2 Oct 2010 05:36:27 -0700
> "Zang Roy-R61911" <r61911@freescale.com> wrote:
> 
> >
> >
> > > -----Original Message-----
> > > From: Anton Vorontsov [mailto:cbouatmailru@gmail.com]
> > > Sent: Monday, September 20, 2010 21:19 PM
> > > To: Zang Roy-R61911
> > > Cc: linux-mtd@lists.infradead.org; dwmw2@infradead.org;
> dedekind1@gmail.com;
> > > akpm@linux-foundation.org; Lan Chunhe-B25806; Wood Scott-B07421;
Gala
> Kumar-
> > > B11780; linuxppc-dev@ozlabs.org
> > > Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver
detect
> nand
> > > flash partitions
> > >
> > > On Fri, Sep 17, 2010 at 03:01:08PM +0800, Roy Zang wrote:
> > > [...]
> > > > +static struct mutex fsl_elbc_nand_mutex;
> > > > +
> > > > +static int __devinit fsl_elbc_nand_probe(struct platform_device
*dev)
> > > >  {
> > > > -	struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
> > > > +	struct fsl_lbc_regs __iomem *lbc;
> > > >  	struct fsl_elbc_mtd *priv;
> > > >  	struct resource res;
> > > > +	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;
...

Thanks.
Roy

  reply	other threads:[~2010-10-14  3:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-17  7:01 [PATCH 1/3 v4] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices Roy Zang
2010-09-17  7:01 ` Roy Zang
2010-09-17  7:01 ` [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions Roy Zang
2010-09-17  7:01   ` Roy Zang
2010-09-17  7:01   ` [PATCH 3/3 v4] P4080/mtd: Fix the freescale lbc issue with 36bit mode Roy Zang
2010-09-17  7:01     ` Roy Zang
2010-09-20 13:19   ` [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions Anton Vorontsov
2010-10-02 12:36     ` Zang Roy-R61911
2010-10-02 12:36       ` Zang Roy-R61911
2010-10-04 15:38       ` Scott Wood
2010-10-04 15:38         ` Scott Wood
2010-10-14  3:09         ` Zang Roy-R61911 [this message]
2010-10-14  3:09           ` Zang Roy-R61911
2010-10-14 16:01           ` Scott Wood
2010-10-14 16:01             ` Scott Wood
2010-10-15  2:15             ` Zang Roy-R61911
2010-10-15  2:15               ` Zang Roy-R61911
2010-10-14  4:14     ` Zang Roy-R61911
2010-10-14  4:14       ` Zang Roy-R61911
2010-09-20 15:37 ` [PATCH 1/3 v4] P4080/eLBC: Make Freescale elbc interrupt common to elbc devices Anton Vorontsov
2010-10-14  6:43   ` Zang Roy-R61911
2010-10-14  6:43     ` Zang Roy-R61911
2010-10-14 16:02     ` Scott Wood
2010-10-14 16:02       ` Scott Wood
2010-10-15  5:03       ` Zang Roy-R61911
2010-10-15  5:03         ` Zang Roy-R61911

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=3850A844E6A3854C827AC5C0BEC7B60A2B02B7@zch01exm23.fsl.freescale.net \
    --to=r61911@freescale.com \
    --cc=B07421@freescale.com \
    --cc=B11780@freescale.com \
    --cc=B21284@freescale.com \
    --cc=B25806@freescale.com \
    --cc=akpm@linux-foundation.org \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.