Commit ffa3eb01 authored by Phil Carmody's avatar Phil Carmody Committed by Benjamin Herrenschmidt

powerpc/via-pmu: fix error path in find_via_pmu()

Cleanup was not in the reverse order from the set-up, so not all
the gotos made sense, and also it was being avoided completely upon
failure of init_pmu().
Signed-off-by: default avatarPhil Carmody <pc+lkml@asdf.org>
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent b05ae4ee
...@@ -332,7 +332,7 @@ int __init find_via_pmu(void) ...@@ -332,7 +332,7 @@ int __init find_via_pmu(void)
} }
if (gpio_reg == NULL) { if (gpio_reg == NULL) {
printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n"); printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
goto fail_gpio; goto fail;
} }
} else } else
pmu_kind = PMU_UNKNOWN; pmu_kind = PMU_UNKNOWN;
...@@ -340,7 +340,7 @@ int __init find_via_pmu(void) ...@@ -340,7 +340,7 @@ int __init find_via_pmu(void)
via = ioremap(taddr, 0x2000); via = ioremap(taddr, 0x2000);
if (via == NULL) { if (via == NULL) {
printk(KERN_ERR "via-pmu: Can't map address !\n"); printk(KERN_ERR "via-pmu: Can't map address !\n");
goto fail; goto fail_via_remap;
} }
out_8(&via[IER], IER_CLR | 0x7f); /* disable all intrs */ out_8(&via[IER], IER_CLR | 0x7f); /* disable all intrs */
...@@ -348,10 +348,8 @@ int __init find_via_pmu(void) ...@@ -348,10 +348,8 @@ int __init find_via_pmu(void)
pmu_state = idle; pmu_state = idle;
if (!init_pmu()) { if (!init_pmu())
via = NULL; goto fail_init;
return 0;
}
printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n", printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n",
PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version); PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version);
...@@ -359,11 +357,15 @@ int __init find_via_pmu(void) ...@@ -359,11 +357,15 @@ int __init find_via_pmu(void)
sys_ctrler = SYS_CTRLER_PMU; sys_ctrler = SYS_CTRLER_PMU;
return 1; return 1;
fail:
of_node_put(vias); fail_init:
iounmap(via);
via = NULL;
fail_via_remap:
iounmap(gpio_reg); iounmap(gpio_reg);
gpio_reg = NULL; gpio_reg = NULL;
fail_gpio: fail:
of_node_put(vias);
vias = NULL; vias = NULL;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment