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: Fri, 15 Oct 2010 10:15:20 +0800 [thread overview] Message-ID: <3850A844E6A3854C827AC5C0BEC7B60A2B0445@zch01exm23.fsl.freescale.net> (raw) In-Reply-To: <20101014110118.11fabed5@udp111988uds.am.freescale.net> > -----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@lists.infradead.org; > dwmw2@infradead.org; dedekind1@gmail.com; akpm@linux-foundation.org; Lan > Chunhe-B25806; Gala Kumar-B11780; linuxppc-dev@ozlabs.org; Hu Mingkai-B21284 > Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand > flash partitions >=20 > On Wed, 13 Oct 2010 20:09:02 -0700 > "Zang Roy-R61911" <r61911@freescale.com> wrote: >=20 > > > > > > + 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? > > > > > > 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; > > ... >=20 > Yes, but this patch looks like the former case, not the > latter.=20 That is right. > Is GCC giving a warning without the initializer? no. we are on the same point. 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: Fri, 15 Oct 2010 10:15:20 +0800 [thread overview] Message-ID: <3850A844E6A3854C827AC5C0BEC7B60A2B0445@zch01exm23.fsl.freescale.net> (raw) In-Reply-To: <20101014110118.11fabed5@udp111988uds.am.freescale.net> > -----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@lists.infradead.org; > dwmw2@infradead.org; dedekind1@gmail.com; akpm@linux-foundation.org; Lan > Chunhe-B25806; Gala Kumar-B11780; linuxppc-dev@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@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
next prev parent reply other threads:[~2010-10-15 2:15 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 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 [this message] 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=3850A844E6A3854C827AC5C0BEC7B60A2B0445@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: linkBe 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.