From d773a008ee3135b28becc5ebce050c931767fed8 Mon Sep 17 00:00:00 2001 From: Simon Glass <sjg@chromium.org> Date: Wed, 2 Dec 2015 10:59:11 -0700 Subject: [PATCH] spl: mmc: Fix compiler warning with CONFIG_DM_MMC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since commit 4188ba3 we get the following warning on rockchip boards: 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; Correct this by move the variable init earlier. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Nikita Kiryanov <nikita@compulab.co.il> --- common/spl/spl_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index b3c2c642e4..43748d05b2 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -248,7 +248,7 @@ int spl_mmc_do_fs_boot(struct mmc *mmc) int spl_mmc_load_image(u32 boot_device) { - struct mmc *mmc; + struct mmc *mmc = NULL; u32 boot_mode; int err = 0; __maybe_unused int part; -- 2.39.5