From: Ulf Hansson <ulf.hansson@linaro.org> To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, Sudeep Holla <sudeep.holla@arm.com>, Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>, Mark Rutland <mark.rutland@arm.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>, Lina Iyer <ilina@codeaurora.org>, Ulf Hansson <ulf.hansson@linaro.org>, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Thu, 28 Feb 2019 14:59:18 +0100 [thread overview] Message-ID: <20190228135919.3747-7-ulf.hansson@linaro.org> (raw) In-Reply-To: <20190228135919.3747-1-ulf.hansson@linaro.org> Instead of having each psci init function taking care of the of_node_put(), let's deal with that from psci_dt_init(), as this enables a bit simpler error path for each psci init function. Cc: Lina Iyer <ilina@codeaurora.org> Co-developed-by: Lina Iyer <lina.iyer@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/firmware/psci/psci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index cbfc936d251c..14d25b54b9f2 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) 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 -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Ulf Hansson <ulf.hansson@linaro.org> To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, Sudeep Holla <sudeep.holla@arm.com>, Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>, Mark Rutland <mark.rutland@arm.com> Cc: Ulf Hansson <ulf.hansson@linaro.org>, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano <daniel.lezcano@linaro.org>, linux-kernel@vger.kernel.org, Lina Iyer <ilina@codeaurora.org>, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/7] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Thu, 28 Feb 2019 14:59:18 +0100 [thread overview] Message-ID: <20190228135919.3747-7-ulf.hansson@linaro.org> (raw) In-Reply-To: <20190228135919.3747-1-ulf.hansson@linaro.org> Instead of having each psci init function taking care of the of_node_put(), let's deal with that from psci_dt_init(), as this enables a bit simpler error path for each psci init function. Cc: Lina Iyer <ilina@codeaurora.org> Co-developed-by: Lina Iyer <lina.iyer@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/firmware/psci/psci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index cbfc936d251c..14d25b54b9f2 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) 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 -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-28 13:59 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-28 13:59 [PATCH 0/7] drivers: firmware: psci: Some cleanup and refactoring Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 13:59 ` [PATCH 1/7] drivers: firmware: psci: Move psci to separate directory Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 14:34 ` Daniel Lezcano 2019-02-28 14:34 ` Daniel Lezcano 2019-03-01 17:03 ` Mark Rutland 2019-03-01 17:03 ` Mark Rutland 2019-02-28 13:59 ` [PATCH 2/7] MAINTAINERS: Update files for PSCI Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 14:35 ` Daniel Lezcano 2019-02-28 14:35 ` Daniel Lezcano 2019-03-01 17:04 ` Mark Rutland 2019-03-01 17:04 ` Mark Rutland 2019-02-28 13:59 ` [PATCH 3/7] drivers: firmware: psci: Split psci_dt_cpu_init_idle() Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 14:42 ` Daniel Lezcano 2019-02-28 14:42 ` Daniel Lezcano 2019-02-28 22:13 ` Ulf Hansson 2019-02-28 22:13 ` Ulf Hansson 2019-03-01 17:07 ` Mark Rutland 2019-03-01 17:07 ` Mark Rutland 2019-02-28 13:59 ` [PATCH 4/7] ARM/ARM64: cpuidle: Let back-end init ops take the driver as input Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 15:30 ` Daniel Lezcano 2019-02-28 15:30 ` Daniel Lezcano 2019-03-01 17:31 ` Mark Rutland 2019-03-01 17:31 ` Mark Rutland 2019-02-28 13:59 ` [PATCH 5/7] drivers: firmware: psci: Simplify state node parsing Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-02-28 15:40 ` Daniel Lezcano 2019-02-28 15:40 ` Daniel Lezcano 2019-02-28 22:26 ` Ulf Hansson 2019-02-28 22:26 ` Ulf Hansson 2019-02-28 22:41 ` Daniel Lezcano 2019-02-28 22:41 ` Daniel Lezcano 2019-03-01 17:28 ` Mark Rutland 2019-03-01 17:28 ` Mark Rutland 2019-03-04 10:14 ` Ulf Hansson 2019-03-04 10:14 ` Ulf Hansson 2019-03-06 18:15 ` Lorenzo Pieralisi 2019-03-06 18:15 ` Lorenzo Pieralisi 2019-03-08 10:36 ` Ulf Hansson 2019-03-08 10:36 ` Ulf Hansson 2019-03-08 11:49 ` Lorenzo Pieralisi 2019-03-08 11:49 ` Lorenzo Pieralisi 2019-03-08 13:07 ` Ulf Hansson 2019-03-08 13:07 ` Ulf Hansson 2019-03-08 13:17 ` Lorenzo Pieralisi 2019-03-08 13:17 ` Lorenzo Pieralisi 2019-03-08 13:23 ` Ulf Hansson 2019-03-08 13:23 ` Ulf Hansson 2019-03-08 13:31 ` Lorenzo Pieralisi 2019-03-08 13:31 ` Lorenzo Pieralisi 2019-03-08 13:43 ` Ulf Hansson 2019-03-08 13:43 ` Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson [this message] 2019-02-28 13:59 ` [PATCH 6/7] drivers: firmware: psci: Simplify error path of psci_dt_init() Ulf Hansson 2019-02-28 13:59 ` [PATCH 7/7] drivers: firmware: psci: Announce support for OS initiated suspend mode Ulf Hansson 2019-02-28 13:59 ` Ulf Hansson 2019-03-01 17:28 ` Stephen Boyd 2019-03-01 17:28 ` Stephen Boyd 2019-03-01 17:28 ` Stephen Boyd 2019-03-04 10:25 ` Ulf Hansson 2019-03-04 10:25 ` Ulf Hansson 2019-03-01 17:32 ` Mark Rutland 2019-03-01 17:32 ` Mark Rutland
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190228135919.3747-7-ulf.hansson@linaro.org \ --to=ulf.hansson@linaro.org \ --cc=Lorenzo.Pieralisi@arm.com \ --cc=daniel.lezcano@linaro.org \ --cc=ilina@codeaurora.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=rjw@rjwysocki.net \ --cc=sudeep.holla@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.