From patchwork Tue Jul 27 06:28:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 486664 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4265367jao; Tue, 27 Jul 2021 00:33:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCwylq2mwF5b9nm2u+eRS+gthDSZ7qKrNqGLV+UqXipcFXP5IXcGRDZaT0Rn1880XvY+zS X-Received: by 2002:a17:90b:1882:: with SMTP id mn2mr18699011pjb.2.1627371233543; Tue, 27 Jul 2021 00:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627371233; cv=none; d=google.com; s=arc-20160816; b=XX5AoxkbXfOPDipFSlm8womM/Mtse+N4q80cGxTVXTEhCHjZbXOIoHRDMosNm+uBRm 8YkNdRdKH4umXWEjgkVlJ8m7n79shx+99OoTdvciDb6xcglcJ+aR9Y87yfOl2UewToiI HPZOoZ09Rxbvx5PUtE6fljLG1Kc/9weoHzfT4c0ssCyqc0TMyHMljXatalckhuELsviq gGzXixyrM2FCjO6Uy0KCQExunlMZ8ZWc1J0SyEwcQj5V0zZ9GmW/KVIUOgUsz+x/6Krw dtuY7sg3+34uJag/TkAEkk5lEQrueHJVZUfVHqS7YnbG0K8G1rQAZvi8lwSXgWYYHfBl 7Zcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-signature; bh=UBvHR+WE9HJW3bOpbE4GnVTRv+Sm9tD8xyvOfRFpLcQ=; b=jUrgv9zOt9O9+j5M3wBWPBHDuu+qBmbGNFO8gFFZ6kIVseS/UjFO8Bn3XuI1kTFcZB 9KHenvBL+yZQjqazwx9q4UeKoOvyc9csqqJAOlWSfQg4OaSgmkAK9JDtDBBvcxh28bnh 2rQo0jlt+mVWt7TZJBCvx0qtbVFgE9rMGaYgyC6NJFHN93Z+oS2fT5JqtQRDDI6BDOkr JEtJ2MIw+mBlCKdUR5xYEdrOLO6vZ8oY/sLeL+WkKtdAXIyJNZwZurfPmssqut04Car4 eiic9KUvPGJ8s0x2/8n5PYBUoScM/jWyM/daZLfOQd9LzqRf3EuJakymyhXTpQAx2Bwe +DDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=yF31xO40; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ddSxW+BF; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id r25si2421475pgv.225.2021.07.27.00.33.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 00:33:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=yF31xO40; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ddSxW+BF; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=UBvHR+WE9HJW3bOpbE4GnVTRv+Sm9tD8xyvOfRFpLcQ=; b=yF31xO404k9FlU YoSwAN7TTch3oixBOHgIsrjHHV4L9kS3xRykh4lFSvY+c1GMxvEz14x4HUzo2EHgkJaSOPnepD5VI eEy9Qk1oQdhI7dmxtuLFPspEsAfUzV3wAgfMOB2ud8st7vUoF9FkS19nG8Qv499L8MQVGpNMpEnNW 0F1oDqpgaF+QqAu8mGjUzKywHWzGl0iEGPzgKQIelbJlKkV84yoeWYQf5mnk9EpW4O5FYBXOqwddj YeXAdOHWPl2H/hQmzeSTN3+zA6BuECZDRP7YTf369h63bWrQEkTKgwb59J0uebFs0T7zHWXYGABl8 SR6ipnQuEWq/9p5DmYWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Ha9-00Dr2I-Ny; Tue, 27 Jul 2021 07:32:54 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GaN-00Dcpe-Fv for linux-mtd@lists.infradead.org; Tue, 27 Jul 2021 06:29:04 +0000 Received: by mail-pj1-x1035.google.com with SMTP id mt6so16384888pjb.1 for ; Mon, 26 Jul 2021 23:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a7gbIhgZL1GB7+CVzKz4WvNGA6a2yfgt3NnYEFDZ3OA=; b=ddSxW+BF6bMPFIS3LGwe/J3xhVpC83qkgDnt5dwEygoPvNeYihLmgqgwrPBB/WtjCR Jz/15O6yuD10YFbiponmOZW9UrhrubeE6/Ba9XH6mR3heqlyqaPeHIlEQk7+D2LkiwUf g4NzpLdDxYQY3Xg3d2RrlNPGNtoKK9OXCySPcnumxPhWSLDAb190lsFhQvS4SPUvayz0 atcKkrG57Lxlm0CCjjEz94GYYmDUtZg4hjEItpxD3jUUjuDl78KYkNtVRtpalvmTwmXL 0ffCP8+P0qxnK00iybgFPgenhnuaeITfQnJKW64/aIpYNKeYr8exZTo35Y95HHnJuUwZ 5C6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a7gbIhgZL1GB7+CVzKz4WvNGA6a2yfgt3NnYEFDZ3OA=; b=DRG7FtLrQJ4eQP+sYuqsWyCkwaHnE4qsaXNins52NbQ3Fc/9JPnzW5rENGyxsIKA1i abXtyXJuGQyvB1I/QmKKVIH1itzD+cK8LQAvoFuSB3861hySumXZFqENLzE3RuDdUrGy Fur2y5DaMMHGO/qMjIoEtLKHYrPeJcbQtgtw/fNf0hSUNq9o73g3Zei3+v13/CQDIbq2 KrxVX2ueB727aqf/rVGCGdtnyeKFryScZ/MUlYkDHWNF7d8dDPAzK60iboMfn2T5HNq5 dZkyvWqWT3xFYTELGyo9aXMOfp2WtalTThwP8Da3xK1rrPJWMH8/vqb80AZMAPlMZiEj fCzw== X-Gm-Message-State: AOAM533Hw/ttwP7uN3AhIS4IG7plQFVm5Aw+4yX3YBEAJbDDyFXMPLCc vmrPVraj0hv2MbJOG8N9vnXi X-Received: by 2002:a17:90a:c24b:: with SMTP id d11mr2731017pjx.91.1627367341536; Mon, 26 Jul 2021 23:29:01 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:404:9e26:4427:70e5:216c:501f]) by smtp.gmail.com with ESMTPSA id g3sm2107960pfi.197.2021.07.26.23.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 23:29:01 -0700 (PDT) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com Cc: richard@nod.at, vigneshr@ti.com, boris.brezillon@collabora.com, tudor.ambarus@microchip.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, dan.carpenter@oracle.com, martin@kaiser.cx, Manivannan Sadhasivam Subject: [PATCH] mtd: rawnand: Fix probe failure due to of_get_nand_secure_regions() Date: Tue, 27 Jul 2021 11:58:13 +0530 Message-Id: <20210727062813.32619-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_232903_595959_18EDCEC7 X-CRM114-Status: GOOD ( 14.63 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Due to 14f97f0b8e2b, the rawnand platforms without "secure-regions" property defined in DT fails to probe. The issue is, of_get_nand_secure_regions() errors out if of_property_count_elems_of_size() re [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1035 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Due to 14f97f0b8e2b, the rawnand platforms without "secure-regions" property defined in DT fails to probe. The issue is, of_get_nand_secure_regions() errors out if of_property_count_elems_of_size() returns a negative error code. If the "secure-regions" property is not present in DT, then also we'll get -EINVAL from of_property_count_elems_of_size() but it should not be treated as an error for platforms not declaring "secure-regions" in DT. So fix this behaviour by checking for the existence of that property in DT and return 0 if it is not present. Fixes: 14f97f0b8e2b ("mtd: rawnand: Add a check in of_get_nand_secure_regions()") Reported-by: Martin Kaiser Signed-off-by: Manivannan Sadhasivam --- drivers/mtd/nand/raw/nand_base.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ Reviewed-by: Martin Kaiser Tested-by: Martin Kaiser diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index cbba46432e39..3d6c6e880520 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5228,8 +5228,14 @@ static bool of_get_nand_on_flash_bbt(struct device_node *np) static int of_get_nand_secure_regions(struct nand_chip *chip) { struct device_node *dn = nand_get_flash_node(chip); + struct property *prop; int nr_elem, i, j; + /* Only proceed if the "secure-regions" property is present in DT */ + prop = of_find_property(dn, "secure-regions", NULL); + if (!prop) + return 0; + nr_elem = of_property_count_elems_of_size(dn, "secure-regions", sizeof(u64)); if (nr_elem <= 0) return nr_elem;