public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Qi Zheng <arch0.zheng@gmail.com>
To: robh+dt@kernel.org, frowand.list@gmail.com, robh@kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Qi Zheng <arch0.zheng@gmail.com>
Subject: [PATCH] of/fdt: Remove duplicate check in early_init_dt_scan_memory()
Date: Sat, 15 Aug 2020 06:56:37 +0800	[thread overview]
Message-ID: <20200814225637.702584-1-arch0.zheng@gmail.com> (raw)

When the value of the first reg is not NULL, there will be
two repeated checks. So modify it.

Signed-off-by: Qi Zheng <arch0.zheng@gmail.com>
---
 drivers/of/fdt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 4602e467ca8b..f54412c00642 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1002,10 +1002,11 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 		return 0;
 
 	reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
-	if (reg == NULL)
+	if (reg == NULL) {
 		reg = of_get_flat_dt_prop(node, "reg", &l);
-	if (reg == NULL)
-		return 0;
+		if (reg == NULL)
+			return 0;
+	}
 
 	endp = reg + (l / sizeof(__be32));
 	hotpluggable = of_get_flat_dt_prop(node, "hotpluggable", NULL);
-- 
2.25.1


             reply	other threads:[~2020-08-14 22:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 22:56 Qi Zheng [this message]
2020-08-17 18:21 ` [PATCH] of/fdt: Remove duplicate check in early_init_dt_scan_memory() Rob Herring
2020-08-17 22:18   ` Qi Zheng

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=20200814225637.702584-1-arch0.zheng@gmail.com \
    --to=arch0.zheng@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=robh@kernel.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