[U-Boot] [PATCH 1/3] spl: mmc: Fix compiler warning with CONFIG_DM_MMC
Simon Glass
sjg at chromium.org
Tue Dec 1 21:01:51 CET 2015
Hi Nikita,
On 1 December 2015 at 05:02, Nikita Kiryanov <nikita at compulab.co.il> 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...
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>> 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 b3c2c64..9df4786 100644
>> --- a/common/spl/spl_mmc.c
>> +++ b/common/spl/spl_mmc.c
>> @@ -84,6 +84,7 @@ static int spl_mmc_find_device(struct mmc **mmc, u32 boot_device)
>> struct udevice *dev;
>> int err, mmc_dev;
>>
>> + *mmc = NULL;
>> mmc_dev = spl_mmc_get_device_index(boot_device);
>> if (mmc_dev < 0)
>> return mmc_dev;
>> @@ -104,7 +105,6 @@ static int spl_mmc_find_device(struct mmc **mmc, u32 boot_device)
>> return err;
>> }
>>
>> - *mmc = NULL;
>> *mmc = mmc_get_mmc_dev(dev);
>> return *mmc != NULL ? 0 : -ENODEV;
>> }
>> --
>> 2.6.0.rc2.230.g3dd15c0
>>
Regards,
Simon
More information about the U-Boot
mailing list