From: Tom Rini Date: Tue, 18 Nov 2014 09:17:17 -0500 Subject: [U-Boot] [PATCH] mcf: Fix cppcheck errors about uninitialized variables In-Reply-To: <20141114132346.C290C382CC5@gemini.denx.de> References: <1415948172-41691-1-git-send-email-b18965@freescale.com> <20141114134733.01c82023@lilith> <20141114132346.C290C382CC5@gemini.denx.de> Message-ID: <20141118141717.GY21184@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Nov 14, 2014 at 02:23:46PM +0100, Wolfgang Denk wrote: > Dear Albert, > > In message <20141114134733.01c82023@lilith> you wrote: > > > > > - u8 bootmode; > > > + u8 bootmode = 0; > > > > If you set bootmode to the default 0 value at declaration, then the code > > that follows in the source file can be simplified: > > > > u8 bootmode = 0; > > ---8<--- > > pcrvalue = in_be32(&pll->pcr) & 0xFF0F0FFF; > > pfdr = pcrvalue >> 24; > > > > if (pfdr == 0x1E) > > bootmode = 0; /* Normal Mode */ > > ---8<--- > > > > The part between scissors is useless now, and in turn, pfdr becomes unneeded. > > Exactly. This was my concern, too - otherwise I had provided auch a > trivial fix. But I think here some deeper understanding of the > intended logic is needed. For clarity, yes, please do a v2 where you've re-organized the code based on what the cppcheck errors point out rather than just a simple silence of the warning, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: