diff options
| author | Phil Carmody <pc+lkml@asdf.org> | 2014-09-16 18:00:53 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-03-16 20:56:34 -0400 |
| commit | ffa3eb010dd8edc696cd958ba684d8a6d1cf3dff (patch) | |
| tree | e6ec1d93d93eae5913d3161bc81352b36f02b026 /drivers/macintosh | |
| parent | b05ae4ee602b7dc90771408ccf0972e1b3801a35 (diff) | |
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: Phil Carmody <pc+lkml@asdf.org>
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh')
| -rw-r--r-- | drivers/macintosh/via-pmu.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index dee88e59f0d3..62212358640d 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
| @@ -332,7 +332,7 @@ int __init find_via_pmu(void) | |||
| 332 | } | 332 | } |
| 333 | if (gpio_reg == NULL) { | 333 | if (gpio_reg == NULL) { |
| 334 | printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n"); | 334 | printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n"); |
| 335 | goto fail_gpio; | 335 | goto fail; |
| 336 | } | 336 | } |
| 337 | } else | 337 | } else |
| 338 | pmu_kind = PMU_UNKNOWN; | 338 | pmu_kind = PMU_UNKNOWN; |
| @@ -340,7 +340,7 @@ int __init find_via_pmu(void) | |||
| 340 | via = ioremap(taddr, 0x2000); | 340 | via = ioremap(taddr, 0x2000); |
| 341 | if (via == NULL) { | 341 | if (via == NULL) { |
| 342 | printk(KERN_ERR "via-pmu: Can't map address !\n"); | 342 | printk(KERN_ERR "via-pmu: Can't map address !\n"); |
| 343 | goto fail; | 343 | goto fail_via_remap; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | out_8(&via[IER], IER_CLR | 0x7f); /* disable all intrs */ | 346 | out_8(&via[IER], IER_CLR | 0x7f); /* disable all intrs */ |
| @@ -348,10 +348,8 @@ int __init find_via_pmu(void) | |||
| 348 | 348 | ||
| 349 | pmu_state = idle; | 349 | pmu_state = idle; |
| 350 | 350 | ||
| 351 | if (!init_pmu()) { | 351 | if (!init_pmu()) |
| 352 | via = NULL; | 352 | goto fail_init; |
| 353 | return 0; | ||
| 354 | } | ||
| 355 | 353 | ||
| 356 | printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n", | 354 | printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n", |
| 357 | PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version); | 355 | PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version); |
| @@ -359,11 +357,15 @@ int __init find_via_pmu(void) | |||
| 359 | sys_ctrler = SYS_CTRLER_PMU; | 357 | sys_ctrler = SYS_CTRLER_PMU; |
| 360 | 358 | ||
| 361 | return 1; | 359 | return 1; |
| 362 | fail: | 360 | |
| 363 | of_node_put(vias); | 361 | fail_init: |
| 362 | iounmap(via); | ||
| 363 | via = NULL; | ||
| 364 | fail_via_remap: | ||
| 364 | iounmap(gpio_reg); | 365 | iounmap(gpio_reg); |
| 365 | gpio_reg = NULL; | 366 | gpio_reg = NULL; |
| 366 | fail_gpio: | 367 | fail: |
| 368 | of_node_put(vias); | ||
| 367 | vias = NULL; | 369 | vias = NULL; |
| 368 | return 0; | 370 | return 0; |
| 369 | } | 371 | } |
