From: Tom Rini Date: Tue, 1 Dec 2015 19:46:51 -0500 Subject: [U-Boot] [PATCH 1/3] spl: mmc: Fix compiler warning with CONFIG_DM_MMC In-Reply-To: References: <1448903949-2092-1-git-send-email-sjg@chromium.org> <1448903949-2092-2-git-send-email-sjg@chromium.org> <20151201120250.GA29932@skynet> <20151201201941.GK9551@bill-the-cat> Message-ID: <20151202004651.GO9551@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 Tue, Dec 01, 2015 at 05:33:32PM -0700, Simon Glass wrote: > Hi Tom, > > On 1 December 2015 at 13:19, Tom Rini wrote: > > On Tue, Dec 01, 2015 at 01:01:51PM -0700, Simon Glass wrote: > >> Hi Nikita, > >> > >> On 1 December 2015 at 05:02, Nikita Kiryanov wrote: > >> > Hi Simon, > >> > > >> > On Mon, Nov 30, 2015 at 10:19:06AM -0700, Simon Glass wrote: > >> >> Since commit 4188ba3 we get the following warning on rockchip boards: > >> >> > >> >> common/spl/spl_mmc.c:111:10: error: 'mmc' undeclared (first use in this function) > >> >> > >> >> Correct this by move the variable init earlier. > >> > > >> > This looks suspicious. If the problem is that the variable is > >> > undeclared, the only way to fix it is to declare the variable, which is > >> > not what this patch does. I would expect this error to persist with > >> > the patch applied. Also, mmc is clearly declared in the function > >> > parameter list. It sounds to me like the source of the compile error is > >> > somewhere earlier in the code. > >> > > >> > >> Well I just tried again and the warning is: > >> > >> common/spl/spl_mmc.c: In function ?spl_mmc_load_image?: > >> common/spl/spl_mmc.c:31:24: warning: ?mmc? may be used uninitialized > >> in this function [-Wmaybe-uninitialized] > >> count = mmc->block_dev.block_read(0, sector, 1, header); > >> ^ > >> common/spl/spl_mmc.c:251:14: note: ?mmc? was declared here > >> struct mmc *mmc; > >> ^ > >> > >> I'll fix the commit message. I'm not sure what I was looking at there... > > > > While you're in there, please just change to setting this to NULL in the > > declaration instead of right above the call. > > I don't think I can do this, as it is a parameter to a function call. Yes you can. I fixed (and lost, blarg, got side-tracked and blew away my changes) by making the declartion on 251 be initalized to NULL. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: