]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
board/linkstation/ide.c: Fix GCC 4.6 build warnings
authorWolfgang Denk <wd@denx.de>
Mon, 7 Nov 2011 21:43:37 +0000 (22:43 +0100)
committerWolfgang Denk <wd@denx.de>
Mon, 7 Nov 2011 21:43:37 +0000 (22:43 +0100)
Fix:
ide.c: In function 'ide_preinit':
ide.c:69:21: warning: array subscript is above array bounds
[-Warray-bounds]
ide.c:69:21: warning: array subscript is above array bounds
[-Warray-bounds]
ide.c:70:17: warning: array subscript is above array bounds
[-Warray-bounds]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
board/linkstation/ide.c

index 568fdf5f2e8ce7b2c06f98ddca4c03bcb0ee0dd5..f3e3fce8242b5b42bd7e54f73c9391ddbd922d62 100644 (file)
@@ -62,14 +62,16 @@ int ide_preinit (void)
                                                           &ide_bus_offset32);
                ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
                ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
-                                                        ide_bus_offset[0] & 0xfffffffe,
-                                                        PCI_REGION_IO);
-               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2,
-                                     (u32 *) &ide_bus_offset[1]);
-               ide_bus_offset[1] &= 0xfffffffe;
-               ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
-                                                        ide_bus_offset[1] & 0xfffffffe,
-                                                        PCI_REGION_IO);
+                                               ide_bus_offset[0] & 0xfffffffe,
+                                               PCI_REGION_IO);
+               if (CONFIG_SYS_IDE_MAXBUS > 1) {
+                       pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2,
+                                             (u32 *) &ide_bus_offset[1]);
+                       ide_bus_offset[1] &= 0xfffffffe;
+                       ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
+                                               ide_bus_offset[1] & 0xfffffffe,
+                                               PCI_REGION_IO);
+               }
        }
 
        if (pci_find_device (PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8212, 0) != -1) {