diff mbox series

soc: imx8m: No need to put node when of_find_compatible_node() failed

Message ID 1584409053-23116-1-git-send-email-Anson.Huang@nxp.com (mailing list archive)
State Mainlined
Commit 04df45fba52177f796a20642b92fdc44e489e174
Headers show
Series soc: imx8m: No need to put node when of_find_compatible_node() failed | expand

Commit Message

Anson Huang March 17, 2020, 1:37 a.m. UTC
No need to put node when of_find_compatible_node() failed, return
immediately to simplify the code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/soc/imx/soc-imx8m.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Shawn Guo April 14, 2020, 1:53 p.m. UTC | #1
On Tue, Mar 17, 2020 at 09:37:33AM +0800, Anson Huang wrote:
> No need to put node when of_find_compatible_node() failed, return
> immediately to simplify the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
index 719e1f18..7b0759a 100644
--- a/drivers/soc/imx/soc-imx8m.c
+++ b/drivers/soc/imx/soc-imx8m.c
@@ -53,11 +53,11 @@  static u32 __init imx8mq_soc_revision(void)
 	struct device_node *np;
 	void __iomem *ocotp_base;
 	u32 magic;
-	u32 rev = 0;
+	u32 rev;
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-ocotp");
 	if (!np)
-		goto out;
+		return 0;
 
 	ocotp_base = of_iomap(np, 0);
 	WARN_ON(!ocotp_base);
@@ -78,9 +78,8 @@  static u32 __init imx8mq_soc_revision(void)
 	soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
 
 	iounmap(ocotp_base);
-
-out:
 	of_node_put(np);
+
 	return rev;
 }