From 695d8e87f27320895a18720c59bccca8ee942f2d Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Thu, 24 May 2012 20:24:49 +0000 Subject: [PATCH] Preset (clear) the ranges we're supposed to fill from the FDT. If a particular range (either I/O memory or I/O port) is not defined in the FDT, we're not handing uninitialized structures back to our caller. --- sys/dev/fdt/fdt_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/fdt/fdt_pci.c b/sys/dev/fdt/fdt_pci.c index 7f0ddd37e3e..68cf89811f3 100644 --- a/sys/dev/fdt/fdt_pci.c +++ b/sys/dev/fdt/fdt_pci.c @@ -100,6 +100,14 @@ fdt_pci_ranges_decode(phandle_t node, struct fdt_pci_range *io_space, size_cells); tuples = len / tuple_size; + /* + * Initialize the ranges so that we don't have to worry about + * having them all defined in the FDT. In particular, it is + * perfectly fine not to want I/O space on PCI busses. + */ + bzero(io_space, sizeof(*io_space)); + bzero(mem_space, sizeof(*mem_space)); + rangesptr = &ranges[0]; offset_cells = 0; for (i = 0; i < tuples; i++) {