linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] soc: brcmstb: Avoid error messages on non-STB platforms
Date: Fri, 12 Jan 2018 14:38:13 +0100	[thread overview]
Message-ID: <20180112133813.3716-3-thierry.reding@gmail.com> (raw)
In-Reply-To: <20180112133813.3716-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

Move the check for STB platforms up into the early initcall so that the
code can abort early (and without an error) if it runs on non-STB
platforms.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/soc/bcm/brcmstb/biuctrl.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/soc/bcm/brcmstb/biuctrl.c b/drivers/soc/bcm/brcmstb/biuctrl.c
index 2b23ae7b5e9b..1044cc6c3ffc 100644
--- a/drivers/soc/bcm/brcmstb/biuctrl.c
+++ b/drivers/soc/bcm/brcmstb/biuctrl.c
@@ -162,22 +162,15 @@ static void __init mcp_b53_set(void)
 	cbc_writel(reg, CPU_WRITEBACK_CTRL_REG);
 }
 
-static int __init setup_hifcpubiuctrl_regs(void)
+static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
 {
-	struct device_node *np, *cpu_dn;
+	struct device_node *cpu_dn;
 	int ret = 0;
 
-	np = of_find_compatible_node(NULL, NULL, "brcm,brcmstb-cpu-biu-ctrl");
-	if (!np) {
-		pr_err("missing BIU control node\n");
-		return -ENODEV;
-	}
-
 	cpubiuctrl_base = of_iomap(np, 0);
 	if (!cpubiuctrl_base) {
 		pr_err("failed to remap BIU control base\n");
-		ret = -ENOMEM;
-		goto out;
+		return -ENOMEM;
 	}
 
 	mcp_wr_pairing_en = of_property_read_bool(np, "brcm,write-pairing");
@@ -185,8 +178,7 @@ static int __init setup_hifcpubiuctrl_regs(void)
 	cpu_dn = of_get_cpu_node(0, NULL);
 	if (!cpu_dn) {
 		pr_err("failed to obtain CPU device node\n");
-		ret = -ENODEV;
-		goto out;
+		return -ENODEV;
 	}
 
 	if (of_device_is_compatible(cpu_dn, "brcm,brahma-b15"))
@@ -201,9 +193,8 @@ static int __init setup_hifcpubiuctrl_regs(void)
 
 	if (BRCM_ID(brcmstb_get_family_id()) == 0x7260)
 		cpubiuctrl_regs = b53_cpubiuctrl_no_wb_regs;
-out:
-	of_node_put(np);
-	return ret;
+
+	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -242,9 +233,15 @@ static struct syscore_ops brcmstb_cpu_credit_syscore_ops = {
 
 static int __init brcmstb_biuctrl_init(void)
 {
+	struct device_node *np;
 	int ret;
 
-	setup_hifcpubiuctrl_regs();
+	np = of_find_compatible_node(NULL, NULL, "brcm,brcmstb-cpu-biu-ctrl");
+	if (!np)
+		return 0;
+
+	setup_hifcpubiuctrl_regs(np);
+	of_node_put(np);
 
 	ret = mcp_write_pairing_set();
 	if (ret) {
-- 
2.15.1

      parent reply	other threads:[~2018-01-12 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 13:38 [PATCH 1/3] soc: brcmstb: Do not leak OF node reference Thierry Reding
2018-01-12 13:38 ` [PATCH 2/3] soc: brcmstb: Do not fail initcalls on non-STB platforms Thierry Reding
2018-01-12 13:38 ` Thierry Reding [this message]

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=20180112133813.3716-3-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).