Skip to content

Commit

Permalink
powerpc/via-pmu: fix error path in find_via_pmu()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Aaro Koskinen <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
Phil Carmody authored and ozbenh committed Mar 17, 2015
1 parent b05ae4e commit ffa3eb0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/macintosh/via-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,38 +332,40 @@ int __init find_via_pmu(void)
}
if (gpio_reg == NULL) {
printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
goto fail_gpio;
goto fail;
}
} else
pmu_kind = PMU_UNKNOWN;

via = ioremap(taddr, 0x2000);
if (via == NULL) {
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[IFR], 0x7f); /* clear IFR */

pmu_state = idle;

if (!init_pmu()) {
via = NULL;
return 0;
}
if (!init_pmu())
goto fail_init;

printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n",
PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version);

sys_ctrler = SYS_CTRLER_PMU;

return 1;
fail:
of_node_put(vias);

fail_init:
iounmap(via);
via = NULL;
fail_via_remap:
iounmap(gpio_reg);
gpio_reg = NULL;
fail_gpio:
fail:
of_node_put(vias);
vias = NULL;
return 0;
}
Expand Down

0 comments on commit ffa3eb0

Please sign in to comment.