From d60dcd9450cf1c4d6482f7cd9c73366c07931bf6 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Sat, 4 Feb 2006 12:55:41 +0100 Subject: [PATCH] [PATCH] powerpc: add refcounting to setup_peg2 and of_get_pci_address setup_peg2 must do some refcounting. of_get_pci_address may need to drop the node Pegasos l2cr : L2 cache was not active, activating PCI bus 0 controlled by pci at 80000000 Badness in kref_get at /home/olaf/kernel/olh/ppc64/linux-2.6.16-rc2-olh/lib/kref.c:32 Call Trace: [C037BD00] [C0007934] show_stack+0x5c/0x184 (unreliable) [C037BD30] [C000E068] program_check_exception+0x184/0x584 [C037BD90] [C000F5F0] ret_from_except_full+0x0/0x4c --- Exception: 700 at kref_get+0xc/0x24 LR = of_node_get+0x24/0x3c [C037BE50] [C004FD94] __pte_alloc_kernel+0x64/0x80 (unreliable) [C037BE70] [C000CA18] of_get_parent+0x34/0x58 [C037BE90] [C0009B18] of_get_address+0x24/0x174 [C037BED0] [C000A108] of_address_to_resource+0x24/0x68 [C037BF00] [C038B128] chrp_find_bridges+0x114/0x470 [C037BF90] [C038AE48] chrp_setup_arch+0x1fc/0x32c [C037BFB0] [C03849B0] setup_arch+0x144/0x188 [C037BFD0] [C037C45C] start_kernel+0x34/0x1a8 [C037BFF0] [000037A0] 0x37a0 Badness in kref_get at /home/olaf/kernel/olh/ppc64/linux-2.6.16-rc2-olh/lib/kref.c:32 Call Trace: [C037BC90] [C0007934] show_stack+0x5c/0x184 (unreliable) [C037BCC0] [C000E068] program_check_exception+0x184/0x584 [C037BD20] [C000F5F0] ret_from_except_full+0x0/0x4c --- Exception: 700 at kref_get+0xc/0x24 LR = of_node_get+0x24/0x3c [C037BDE0] [00000000] 0x0 (unreliable) [C037BE00] [C000CA18] of_get_parent+0x34/0x58 [C037BE20] [C0009CE8] of_translate_address+0x2c/0x2fc [C037BEA0] [C0009FE8] __of_address_to_resource+0x30/0xc4 [C037BED0] [C000A130] of_address_to_resource+0x4c/0x68 [C037BF00] [C038B128] chrp_find_bridges+0x114/0x470 [C037BF90] [C038AE48] chrp_setup_arch+0x1fc/0x32c [C037BFB0] [C03849B0] setup_arch+0x144/0x188 [C037BFD0] [C037C45C] start_kernel+0x34/0x1a8 [C037BFF0] [000037A0] 0x37a0 PCI bus 0 controlled by pci at c0000000 Top of RAM: 0x10000000, Total RAM: 0x10000000 Signed-off-by: Olaf Hering Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/prom_parse.c | 4 +++- arch/powerpc/platforms/chrp/pci.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index a8099c80615..3934c227549 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c @@ -465,8 +465,10 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, if (parent == NULL) return NULL; bus = of_match_bus(parent); - if (strcmp(bus->name, "pci")) + if (strcmp(bus->name, "pci")) { + of_node_put(parent); return NULL; + } bus->count_cells(dev, &na, &ns); of_node_put(parent); if (!OF_CHECK_COUNTS(na, ns)) diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index 00c52f27ef4..8ef279ad36a 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c @@ -204,9 +204,11 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d struct device_node *root = find_path_device("/"); struct device_node *rtas; + of_node_get(root); rtas = of_find_node_by_name (root, "rtas"); if (rtas) { hose->ops = &rtas_pci_ops; + of_node_put(rtas); } else { printk ("RTAS supporting Pegasos OF not found, please upgrade" " your firmware\n"); -- 2.41.0