RE: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver detect nand flash partitions
From: Zang Roy-R61911 <hidden>
Date: 2010-10-14 03:09:11
-----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" [off-list ref] wrote: =20quoted
quoted
-----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;quoted
quoted
akpm@linux-foundation.org; Lan Chunhe-B25806; Wood Scott-B07421;
Gala
Kumar-quoted
quoted
B11780; linuxppc-dev@ozlabs.org Subject: Re: [PATCH 2/3 v4] P4080/mtd: Only make elbc nand driver
detect
nandquoted
quoted
flash partitions On Fri, Sep 17, 2010 at 03:01:08PM +0800, Roy Zang wrote: [...]quoted
+static struct mutex fsl_elbc_nand_mutex; + +static int __devinit fsl_elbc_nand_probe(struct platform_device
*dev)
quoted
quoted
quoted
{ - 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