tree: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/resource head: 4704207c075cd99a51e58ef75c185652b17fadd8 commit: 3f3e689a67ba3d0ac2d10fd3b99c1bd0331415be [4/10] PCI: Use devm_kzalloc() in of_pci_get_host_bridge_resources() path config: x86_64-randconfig-x002-201819 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: git checkout 3f3e689a67ba3d0ac2d10fd3b99c1bd0331415be # save the attached .config to linux build tree make ARCH=x86_64 Note: the pci/pci/resource HEAD 4704207c075cd99a51e58ef75c185652b17fadd8 builds fine. It only hurts bisectibility. All errors (new ones prefixed by >>): drivers/pci/of.c: In function '__of_pci_get_host_bridge_resources': >> drivers/pci/of.c:315:4: error: label 'parse_failed' used but not defined goto parse_failed; ^~~~ vim +/parse_failed +315 drivers/pci/of.c 4670d610 Rob Herring 2018-01-17 244 4670d610 Rob Herring 2018-01-17 245 #if defined(CONFIG_OF_ADDRESS) 3f3e689a Jan Kiszka 2018-04-30 246 static int __of_pci_get_host_bridge_resources(struct device *dev, 08c1b3b1 Jan Kiszka 2018-04-30 247 struct device_node *dev_node, 4670d610 Rob Herring 2018-01-17 248 unsigned char busno, unsigned char bus_max, 4670d610 Rob Herring 2018-01-17 249 struct list_head *resources, resource_size_t *io_base) 4670d610 Rob Herring 2018-01-17 250 { 4670d610 Rob Herring 2018-01-17 251 struct resource *res; 4670d610 Rob Herring 2018-01-17 252 struct resource *bus_range; 4670d610 Rob Herring 2018-01-17 253 struct of_pci_range range; 4670d610 Rob Herring 2018-01-17 254 struct of_pci_range_parser parser; 4670d610 Rob Herring 2018-01-17 255 char range_type[4]; 4670d610 Rob Herring 2018-01-17 256 int err; 4670d610 Rob Herring 2018-01-17 257 4670d610 Rob Herring 2018-01-17 258 if (io_base) 4670d610 Rob Herring 2018-01-17 259 *io_base = (resource_size_t)OF_BAD_ADDR; 4670d610 Rob Herring 2018-01-17 260 3f3e689a Jan Kiszka 2018-04-30 261 if (dev) 3f3e689a Jan Kiszka 2018-04-30 262 bus_range = devm_kzalloc(dev,sizeof(*bus_range), GFP_KERNEL); 3f3e689a Jan Kiszka 2018-04-30 263 else 4670d610 Rob Herring 2018-01-17 264 bus_range = kzalloc(sizeof(*bus_range), GFP_KERNEL); 4670d610 Rob Herring 2018-01-17 265 if (!bus_range) 4670d610 Rob Herring 2018-01-17 266 return -ENOMEM; 4670d610 Rob Herring 2018-01-17 267 08c1b3b1 Jan Kiszka 2018-04-30 268 pr_info("host bridge %pOF ranges:\n", dev_node); 4670d610 Rob Herring 2018-01-17 269 08c1b3b1 Jan Kiszka 2018-04-30 270 err = of_pci_parse_bus_range(dev_node, bus_range); 4670d610 Rob Herring 2018-01-17 271 if (err) { 4670d610 Rob Herring 2018-01-17 272 bus_range->start = busno; 4670d610 Rob Herring 2018-01-17 273 bus_range->end = bus_max; 4670d610 Rob Herring 2018-01-17 274 bus_range->flags = IORESOURCE_BUS; 4670d610 Rob Herring 2018-01-17 275 pr_info(" No bus range found for %pOF, using %pR\n", 08c1b3b1 Jan Kiszka 2018-04-30 276 dev_node, bus_range); 4670d610 Rob Herring 2018-01-17 277 } else { 4670d610 Rob Herring 2018-01-17 278 if (bus_range->end > bus_range->start + bus_max) 4670d610 Rob Herring 2018-01-17 279 bus_range->end = bus_range->start + bus_max; 4670d610 Rob Herring 2018-01-17 280 } 4670d610 Rob Herring 2018-01-17 281 pci_add_resource(resources, bus_range); 4670d610 Rob Herring 2018-01-17 282 4670d610 Rob Herring 2018-01-17 283 /* Check for ranges property */ 08c1b3b1 Jan Kiszka 2018-04-30 284 err = of_pci_range_parser_init(&parser, dev_node); 4670d610 Rob Herring 2018-01-17 285 if (err) 3f3e689a Jan Kiszka 2018-04-30 286 return err; 4670d610 Rob Herring 2018-01-17 287 4670d610 Rob Herring 2018-01-17 288 pr_debug("Parsing ranges property...\n"); 4670d610 Rob Herring 2018-01-17 289 for_each_of_pci_range(&parser, &range) { 4670d610 Rob Herring 2018-01-17 290 /* Read next ranges element */ 4670d610 Rob Herring 2018-01-17 291 if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_IO) 4670d610 Rob Herring 2018-01-17 292 snprintf(range_type, 4, " IO"); 4670d610 Rob Herring 2018-01-17 293 else if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_MEM) 4670d610 Rob Herring 2018-01-17 294 snprintf(range_type, 4, "MEM"); 4670d610 Rob Herring 2018-01-17 295 else 4670d610 Rob Herring 2018-01-17 296 snprintf(range_type, 4, "err"); 4670d610 Rob Herring 2018-01-17 297 pr_info(" %s %#010llx..%#010llx -> %#010llx\n", range_type, 4670d610 Rob Herring 2018-01-17 298 range.cpu_addr, range.cpu_addr + range.size - 1, 4670d610 Rob Herring 2018-01-17 299 range.pci_addr); 4670d610 Rob Herring 2018-01-17 300 4670d610 Rob Herring 2018-01-17 301 /* 4670d610 Rob Herring 2018-01-17 302 * If we failed translation or got a zero-sized region 4670d610 Rob Herring 2018-01-17 303 * then skip this range 4670d610 Rob Herring 2018-01-17 304 */ 4670d610 Rob Herring 2018-01-17 305 if (range.cpu_addr == OF_BAD_ADDR || range.size == 0) 4670d610 Rob Herring 2018-01-17 306 continue; 4670d610 Rob Herring 2018-01-17 307 3f3e689a Jan Kiszka 2018-04-30 308 if (dev) 3f3e689a Jan Kiszka 2018-04-30 309 res = devm_kzalloc(dev, sizeof(struct resource), 3f3e689a Jan Kiszka 2018-04-30 310 GFP_KERNEL); 3f3e689a Jan Kiszka 2018-04-30 311 else 4670d610 Rob Herring 2018-01-17 312 res = kzalloc(sizeof(struct resource), GFP_KERNEL); 4670d610 Rob Herring 2018-01-17 313 if (!res) { 4670d610 Rob Herring 2018-01-17 314 err = -ENOMEM; 4670d610 Rob Herring 2018-01-17 @315 goto parse_failed; 4670d610 Rob Herring 2018-01-17 316 } 4670d610 Rob Herring 2018-01-17 317 08c1b3b1 Jan Kiszka 2018-04-30 318 err = of_pci_range_to_resource(&range, dev_node, res); 4670d610 Rob Herring 2018-01-17 319 if (err) { 4670d610 Rob Herring 2018-01-17 320 kfree(res); 4670d610 Rob Herring 2018-01-17 321 continue; 4670d610 Rob Herring 2018-01-17 322 } 4670d610 Rob Herring 2018-01-17 323 4670d610 Rob Herring 2018-01-17 324 if (resource_type(res) == IORESOURCE_IO) { 4670d610 Rob Herring 2018-01-17 325 if (!io_base) { 4670d610 Rob Herring 2018-01-17 326 pr_err("I/O range found for %pOF. Please provide an io_base pointer to save CPU base address\n", 08c1b3b1 Jan Kiszka 2018-04-30 327 dev_node); 3f3e689a Jan Kiszka 2018-04-30 328 return -EINVAL; 4670d610 Rob Herring 2018-01-17 329 } 4670d610 Rob Herring 2018-01-17 330 if (*io_base != (resource_size_t)OF_BAD_ADDR) 4670d610 Rob Herring 2018-01-17 331 pr_warn("More than one I/O resource converted for %pOF. CPU base address for old range lost!\n", 08c1b3b1 Jan Kiszka 2018-04-30 332 dev_node); 4670d610 Rob Herring 2018-01-17 333 *io_base = range.cpu_addr; 4670d610 Rob Herring 2018-01-17 334 } 4670d610 Rob Herring 2018-01-17 335 4670d610 Rob Herring 2018-01-17 336 pci_add_resource_offset(resources, res, res->start - range.pci_addr); 4670d610 Rob Herring 2018-01-17 337 } 4670d610 Rob Herring 2018-01-17 338 4670d610 Rob Herring 2018-01-17 339 return 0; 4670d610 Rob Herring 2018-01-17 340 } 08c1b3b1 Jan Kiszka 2018-04-30 341 :::::: The code at line 315 was first introduced by commit :::::: 4670d610d59233b017a6ea1fa25bbf06dabbff42 PCI: Move OF-related PCI functions into PCI core :::::: TO: Rob Herring <robh@xxxxxxxxxx> :::::: CC: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip