From: York Sun Date: Wed, 8 Aug 2012 16:16:21 -0700 Subject: [U-Boot] [PATCH] powerpc/mpc85xx: Make NMG_CPU_A011 workaround conditional In-Reply-To: References: <1337392391-26822-1-git-send-email-yorksun@freescale.com> Message-ID: <1344467781.18960.41.camel@oslab-l1> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, 2012-08-08 at 15:09 -0500, Andy Fleming wrote: > Please copy me on any 85xx U-Boot patches. > > > > > > +#define HWCONFIG_BUFFER_SIZE 128 > > > [...] > > > + char buffer[HWCONFIG_BUFFER_SIZE]; > > + char *buf = NULL; > > + > > + if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0) > > + buf = buffer; > > > This seems fragile. I suppose there's no way to ensure that this > succeeds, but we should at least check to see if the buffer we pass in > was big enough, and let the user know that we were looking for the > A011 erratum setting, and may not have found it because the hwconfig > string was more than 128 characters. > If the buffer isn't big enough, getenv_f() will print a message saying that. Is that enough? Or do you prefer another warning when fsl_cpu_a011 is not detected? It seems a little bit redundant. York