From: Samuel Holland <samuel@sholland.org>
Date: Sun, 22 Jan 2023 22:06:33 +0000 (-0600)
Subject: mtd: nand: sunxi: Remove an unnecessary check
X-Git-Tag: v2025.01-rc5-pxa1908~1022^2~8
X-Git-Url: http://git.dujemihanovic.xyz/html/static/gitweb.css?a=commitdiff_plain;h=b05bf9415705faffc2a45c2a5f5385f119f9a8b1;p=u-boot.git

mtd: nand: sunxi: Remove an unnecessary check

Each chip is required to have a unique CS number ("reg" property) in the
range 0-7, so there is no need to separately count the number of chips.

Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---

diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index c378f08f68..0f10edfdb2 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -1766,16 +1766,6 @@ static int sunxi_nand_chips_init(int node, struct sunxi_nfc *nfc)
 	int nand_node;
 	int ret, i = 0;
 
-	for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0;
-	     nand_node = fdt_next_subnode(blob, nand_node))
-		i++;
-
-	if (i > 8) {
-		dev_err(nfc->dev, "too many NAND chips: %d (max = 8)\n", i);
-		return -EINVAL;
-	}
-
-	i = 0;
 	for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0;
 	     nand_node = fdt_next_subnode(blob, nand_node)) {
 		ret = sunxi_nand_chip_init(nand_node, nfc, i++);