mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00:00
drivers: firmware: psci: Simplify error path of psci_dt_init()
Instead of having each PSCI init function taking care of the of_node_put(), deal with that from psci_dt_init(), as this enables a bit simpler error path for each PSCI init function. Co-developed-by: Lina Iyer <lina.iyer@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
0865d20c50
commit
d036b5cfef
@ -609,9 +609,9 @@ static int __init psci_0_2_init(struct device_node *np)
|
||||
int err;
|
||||
|
||||
err = get_set_conduit_method(np);
|
||||
|
||||
if (err)
|
||||
goto out_put_node;
|
||||
return err;
|
||||
|
||||
/*
|
||||
* Starting with v0.2, the PSCI specification introduced a call
|
||||
* (PSCI_VERSION) that allows probing the firmware version, so
|
||||
@ -619,11 +619,7 @@ static int __init psci_0_2_init(struct device_node *np)
|
||||
* can be carried out according to the specific version reported
|
||||
* by firmware
|
||||
*/
|
||||
err = psci_probe();
|
||||
|
||||
out_put_node:
|
||||
of_node_put(np);
|
||||
return err;
|
||||
return psci_probe();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -635,9 +631,8 @@ static int __init psci_0_1_init(struct device_node *np)
|
||||
int err;
|
||||
|
||||
err = get_set_conduit_method(np);
|
||||
|
||||
if (err)
|
||||
goto out_put_node;
|
||||
return err;
|
||||
|
||||
pr_info("Using PSCI v0.1 Function IDs from DT\n");
|
||||
|
||||
@ -661,9 +656,7 @@ static int __init psci_0_1_init(struct device_node *np)
|
||||
psci_ops.migrate = psci_migrate;
|
||||
}
|
||||
|
||||
out_put_node:
|
||||
of_node_put(np);
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id psci_of_match[] __initconst = {
|
||||
@ -678,6 +671,7 @@ int __init psci_dt_init(void)
|
||||
struct device_node *np;
|
||||
const struct of_device_id *matched_np;
|
||||
psci_initcall_t init_fn;
|
||||
int ret;
|
||||
|
||||
np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np);
|
||||
|
||||
@ -685,7 +679,10 @@ int __init psci_dt_init(void)
|
||||
return -ENODEV;
|
||||
|
||||
init_fn = (psci_initcall_t)matched_np->data;
|
||||
return init_fn(np);
|
||||
ret = init_fn(np);
|
||||
|
||||
of_node_put(np);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
Loading…
Reference in New Issue
Block a user