[U-Boot] [PATCH] pci_rom.c: Fix may be used uninitialized warning

With gcc-5.x we get: drivers/pci/pci_rom.c: In function 'dm_pci_run_vga_bios': drivers/pci/pci_rom.c:352:3: warning: 'ram' may be used uninitialized in this function [-Wmaybe-uninitialized]
While unconvinced that this can happen in practice (if we malloc we set alloced to true, it will be false otherwise), silence the compiler.
Signed-off-by: Tom Rini trini@konsulko.com --- drivers/pci/pci_rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 8c83be6..ed2f61d 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -266,7 +266,7 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), int exec_method) { struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); - struct pci_rom_header *rom, *ram; + struct pci_rom_header *rom, *ram = NULL; int vesa_mode = -1; bool emulate, alloced; int ret;

On Sat, Jan 16, 2016 at 10:50 PM, Tom Rini trini@konsulko.com wrote:
With gcc-5.x we get: drivers/pci/pci_rom.c: In function 'dm_pci_run_vga_bios': drivers/pci/pci_rom.c:352:3: warning: 'ram' may be used uninitialized in this function [-Wmaybe-uninitialized]
While unconvinced that this can happen in practice (if we malloc we set alloced to true, it will be false otherwise), silence the compiler.
Signed-off-by: Tom Rini trini@konsulko.com
drivers/pci/pci_rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On 16 January 2016 at 07:58, Bin Meng bmeng.cn@gmail.com wrote:
On Sat, Jan 16, 2016 at 10:50 PM, Tom Rini trini@konsulko.com wrote:
With gcc-5.x we get: drivers/pci/pci_rom.c: In function 'dm_pci_run_vga_bios': drivers/pci/pci_rom.c:352:3: warning: 'ram' may be used uninitialized in this function [-Wmaybe-uninitialized]
While unconvinced that this can happen in practice (if we malloc we set alloced to true, it will be false otherwise), silence the compiler.
Signed-off-by: Tom Rini trini@konsulko.com
drivers/pci/pci_rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks Tom. I did something wrong there...
Reviewed-by: Simon Glass sjg@chromium.org

On Sat, Jan 16, 2016 at 02:50:26PM +0000, Tom Rini wrote:
With gcc-5.x we get: drivers/pci/pci_rom.c: In function 'dm_pci_run_vga_bios': drivers/pci/pci_rom.c:352:3: warning: 'ram' may be used uninitialized in this function [-Wmaybe-uninitialized]
While unconvinced that this can happen in practice (if we malloc we set alloced to true, it will be false otherwise), silence the compiler.
Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Bin Meng bmeng.cn@gmail.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!
participants (3)
-
Bin Meng
-
Simon Glass
-
Tom Rini