Skip to contentSkip to conversation

pci_rom.c: Fix may be used uninitialized warning

PATCH In review Tom Rini 3 participants 4 messages Jan 16, 2016 – Jan 19, 2016 PCI

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/pci/pci_rom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_rom.c +1 -1
index 8c83be6..ed2f61d 100644
@@ -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;
Signature · 1 line
2.7.0.rc3
#1 lore raw

PATCH 1/1 pci_rom.c: Fix may be used uninitialized warning

Quoted 5 lines · Tom Rini

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]

Quoted 8 lines

While unconvinced that this can happen in practice (if we malloc we set alloced to true, it will be false otherwise), silence the compiler.

---
 drivers/pci/pci_rom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 pci_rom.c: Fix may be used uninitialized warning

Quoted 9 lines · Bin Meng
Quoted 8 lines · Tom Rini

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.

Quoted 7 lines
Quoted 5 lines
---
 drivers/pci/pci_rom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks Tom. I did something wrong there...

author
#3 lore raw
In reply to Tom Rini
Quoted 11 lines · Tom Rini

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160119/a1e7c8e6/attachment.sig>