aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-07-03 03:24:15 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-03 03:24:15 -0400
commit7c6efda5996c26c468eaba178af9bac8b70dbdcb (patch)
tree492ae1015db7eb70d7529bf30b94161f88b0bd18 /arch
parent980a65136569b841cebaad524a34482b0b1627a9 (diff)
[POWERPC] Fix error handling in detecting legacy serial ports
Previously we weren't checking for failures in translating device addresses from the firmware. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/legacy_serial.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 4cf0b971976b..a55056676ca4 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -126,6 +126,8 @@ static int __init add_legacy_soc_port(struct device_node *np,
126 return -1; 126 return -1;
127 127
128 addr = of_translate_address(soc_dev, addrp); 128 addr = of_translate_address(soc_dev, addrp);
129 if (addr == OF_BAD_ADDR)
130 return -1;
129 131
130 /* Add port, irq will be dealt with later. We passed a translated 132 /* Add port, irq will be dealt with later. We passed a translated
131 * IO port value. It will be fixed up later along with the irq 133 * IO port value. It will be fixed up later along with the irq
@@ -141,6 +143,8 @@ static int __init add_legacy_isa_port(struct device_node *np,
141 int index = -1; 143 int index = -1;
142 phys_addr_t taddr; 144 phys_addr_t taddr;
143 145
146 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
147
144 /* Get the ISA port number */ 148 /* Get the ISA port number */
145 reg = (u32 *)get_property(np, "reg", NULL); 149 reg = (u32 *)get_property(np, "reg", NULL);
146 if (reg == NULL) 150 if (reg == NULL)
@@ -161,9 +165,12 @@ static int __init add_legacy_isa_port(struct device_node *np,
161 165
162 /* Translate ISA address */ 166 /* Translate ISA address */
163 taddr = of_translate_address(np, reg); 167 taddr = of_translate_address(np, reg);
168 if (taddr == OF_BAD_ADDR)
169 return -1;
164 170
165 /* Add port, irq will be dealt with later */ 171 /* Add port, irq will be dealt with later */
166 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, NO_IRQ, UPF_BOOT_AUTOCONF); 172 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr,
173 NO_IRQ, UPF_BOOT_AUTOCONF);
167 174
168} 175}
169 176
@@ -176,6 +183,8 @@ static int __init add_legacy_pci_port(struct device_node *np,
176 unsigned int flags; 183 unsigned int flags;
177 int iotype, index = -1, lindex = 0; 184 int iotype, index = -1, lindex = 0;
178 185
186 DBG(" -> add_legacy_pci_port(%s)\n", np->full_name);
187
179 /* We only support ports that have a clock frequency properly 188 /* We only support ports that have a clock frequency properly
180 * encoded in the device-tree (that is have an fcode). Anything 189 * encoded in the device-tree (that is have an fcode). Anything
181 * else can't be used that early and will be normally probed by 190 * else can't be used that early and will be normally probed by
@@ -194,6 +203,8 @@ static int __init add_legacy_pci_port(struct device_node *np,
194 /* We only support BAR 0 for now */ 203 /* We only support BAR 0 for now */
195 iotype = (flags & IORESOURCE_MEM) ? UPIO_MEM : UPIO_PORT; 204 iotype = (flags & IORESOURCE_MEM) ? UPIO_MEM : UPIO_PORT;
196 addr = of_translate_address(pci_dev, addrp); 205 addr = of_translate_address(pci_dev, addrp);
206 if (addr == OF_BAD_ADDR)
207 return -1;
197 208
198 /* Set the IO base to the same as the translated address for MMIO, 209 /* Set the IO base to the same as the translated address for MMIO,
199 * or to the domain local IO base for PIO (it will be fixed up later) 210 * or to the domain local IO base for PIO (it will be fixed up later)