aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/psci/psci.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-04-10 04:20:24 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-04-12 04:59:37 -0400
commitd036b5cfef6360808117abd0c53775b7a8981a2e (patch)
tree4001e3976c196db22a29b905f58609a9b2741f85 /drivers/firmware/psci/psci.c
parent0865d20c50741e1d37d4a1108764e5e45a83973e (diff)
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>
Diffstat (limited to 'drivers/firmware/psci/psci.c')
-rw-r--r--drivers/firmware/psci/psci.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 9788bfc1cf8b..e480e0af632c 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -609,9 +609,9 @@ static int __init psci_0_2_init(struct device_node *np)
609 int err; 609 int err;
610 610
611 err = get_set_conduit_method(np); 611 err = get_set_conduit_method(np);
612
613 if (err) 612 if (err)
614 goto out_put_node; 613 return err;
614
615 /* 615 /*
616 * Starting with v0.2, the PSCI specification introduced a call 616 * Starting with v0.2, the PSCI specification introduced a call
617 * (PSCI_VERSION) that allows probing the firmware version, so 617 * (PSCI_VERSION) that allows probing the firmware version, so
@@ -619,11 +619,7 @@ static int __init psci_0_2_init(struct device_node *np)
619 * can be carried out according to the specific version reported 619 * can be carried out according to the specific version reported
620 * by firmware 620 * by firmware
621 */ 621 */
622 err = psci_probe(); 622 return psci_probe();
623
624out_put_node:
625 of_node_put(np);
626 return err;
627} 623}
628 624
629/* 625/*
@@ -635,9 +631,8 @@ static int __init psci_0_1_init(struct device_node *np)
635 int err; 631 int err;
636 632
637 err = get_set_conduit_method(np); 633 err = get_set_conduit_method(np);
638
639 if (err) 634 if (err)
640 goto out_put_node; 635 return err;
641 636
642 pr_info("Using PSCI v0.1 Function IDs from DT\n"); 637 pr_info("Using PSCI v0.1 Function IDs from DT\n");
643 638
@@ -661,9 +656,7 @@ static int __init psci_0_1_init(struct device_node *np)
661 psci_ops.migrate = psci_migrate; 656 psci_ops.migrate = psci_migrate;
662 } 657 }
663 658
664out_put_node: 659 return 0;
665 of_node_put(np);
666 return err;
667} 660}
668 661
669static const struct of_device_id psci_of_match[] __initconst = { 662static const struct of_device_id psci_of_match[] __initconst = {
@@ -678,6 +671,7 @@ int __init psci_dt_init(void)
678 struct device_node *np; 671 struct device_node *np;
679 const struct of_device_id *matched_np; 672 const struct of_device_id *matched_np;
680 psci_initcall_t init_fn; 673 psci_initcall_t init_fn;
674 int ret;
681 675
682 np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); 676 np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np);
683 677
@@ -685,7 +679,10 @@ int __init psci_dt_init(void)
685 return -ENODEV; 679 return -ENODEV;
686 680
687 init_fn = (psci_initcall_t)matched_np->data; 681 init_fn = (psci_initcall_t)matched_np->data;
688 return init_fn(np); 682 ret = init_fn(np);
683
684 of_node_put(np);
685 return ret;
689} 686}
690 687
691#ifdef CONFIG_ACPI 688#ifdef CONFIG_ACPI