From patchwork Thu Nov 19 07:13:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 328377 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2110:0:0:0:0 with SMTP id qn16csp116848ejb; Wed, 18 Nov 2020 23:13:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3aVz978wPLRQcZvwljU3e23joJNaugxrgrtwtXsZIY4HqQOiJLenhAyHXSLN489rabuvW X-Received: by 2002:adf:ec49:: with SMTP id w9mr8463422wrn.62.1605770034287; Wed, 18 Nov 2020 23:13:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605770034; cv=none; d=google.com; s=arc-20160816; b=Y+jU+XupsrVaHPA34SgWHK5VRDrjAxU0PGXC/to0/AieD5hWPp2nyUXO7OmUf8xaOG R3uXa4IitaLfFcZoLIy2qoGQcv6b396PAsQD3i1RBk2bqMhmsN3z7jyzMlH1MPn4l5ei d7t4NraksKf5vtjsu6lYHwmjEJMmqjLLfDq7/nW45nO4alBf2/tTH9cwM+Q0FVh4paM2 pToIDJbVEdfKK4W2ULTqO2mI6amBAzSeVW7zNajk/MGECbJgue1eI0FIO5wZ+xg62E3t UsSr5dtCEiK0cAF7JJ0/19GR46asyKtzvRLLklH5gzMHBifIpqEFhruHI9/uxT7TTDaK +cgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=Ha72IdCglX5I2VMZsXHnk6dnCgg/xSmMM6pUzd8Ft00=; b=vpzcNPHHBDz8FDii4LZIEiE7ldsR0KWAKwCupR37vWXg5yUsCkYtUPdX1QFGwCVeJd QXuiXI+7uqbBb05/EEnn4AQZHAPMPb51TeIyQI3LEquJlyGhsemgNlu0QFm21aNVOjze J0f6OteMD9i/sawcmLcWH0MIo12QTdOpdp6GBAI19O0f9XQnK0nIartoK5HJhxNStrIT DZljRgfI0AfdlPHVi5e2DyHX2jAnENLK97gMJw7GQX+QC+C481K7N5LikDkCG8ZvFKjw ncf5tYB8MHPdN6sJEyOpgVM4bSTu0Cx/KUSvmtH8J/n2R71rUYbti+65DN0vPQSkOEoZ e/Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=rcKblESL; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fF2c5BlB; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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 merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id q10si4074851wme.57.2020.11.18.23.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=rcKblESL; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fF2c5BlB; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ha72IdCglX5I2VMZsXHnk6dnCgg/xSmMM6pUzd8Ft00=; b=rcKblESLqcJwZd/+tGSzxS675D 0vZM/Xi9U1hL/k9RoOk4hkiBz46myk+47P3IvGabOL33MvBGPWhd56BrlZ/u8PWsXOjdr/3GF+jc4 HhJVKecGgmregZpHl/3QzQqIWMobwrEJwzTFo7o0taHbGDnPll0scUbIlzOnbN+Q9eNg1qGvZ40yT s6vOqL6HYCMpVjfYNpJJLQ/qZlYPzz+tErOwjggaG/N8RfUJ16hjhqEE+xw8xLlPH5CAAkJfYI1dC WoS349mBSHDfCdtwi5l1mVnVN2Kt+Vc33g1kndHx9vxAGSxajmhyRSD80QmBJH8iLZepSNCOLBCaf qXTqjW9g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8N-0005no-T9; Thu, 19 Nov 2020 07:13:36 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8K-0005n9-Ae for linux-mtd@lists.infradead.org; Thu, 19 Nov 2020 07:13:33 +0000 Received: by mail-pf1-x432.google.com with SMTP id t8so3571913pfg.8 for ; Wed, 18 Nov 2020 23:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jVl81ZS9fFrGd+ufPYRPV6WNHXbkD50mNDrAZQnv39A=; b=fF2c5BlBENboF8Y1Nu+N/7xWoSQULa2VjGFTzkM/PYZUg9jiRfN5JYusVOEWtV9MPl jJYZmS5J/IlXmMNYIuXyb4V/n5xXtnf38pU9c4PJe4GeKYVCVvQgNz75dWekVZZNX+6o eprwSUaJ7Ouz1qi/CaVZ3on68RVP1ntMBe+7+00OyIW0/m2t7EnL1JRgLPKsvyae9K6H ckDeHn+mGx9YaSAe9sYoxmEPsIYolSMkg3ccFTNiYHlLeWAd79KOw/Ses7BqCK05kjSD qRae4SK6ns5N+JKHV4+bdFF1oyoso50x9fKdpCKBiwMrqyXG7TEJ5klCi1US9VVr5G0H AsXw== 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:in-reply-to :references; bh=jVl81ZS9fFrGd+ufPYRPV6WNHXbkD50mNDrAZQnv39A=; b=m9/3m0/sOXC2HIWuprWJHYsAOZwe0Fq7z6075sRGQI0YS93NQU7PmhD5kJ02zThxbx TIprQk77wCCGqWda0r25sGmbs6VKGkIf+4hg6yYKIs+t0TACRf57YFYrKzCZHjiWfFCL YH9fC1/ceWBh/Wo1dahMHDW9fa/Sg6dseF+GUiJE/36+KIxLBAAxOkiY6Qdg7firwsRf r11qZBqkfhEBz3IuxaV3uVD+qPEXHMWea/j/Ph2SCvPBV++B5OvlKr6zwPA7PXKYHTKc Tvfp/mKUMh1gS68LlNUkKYQf9YRNgOfxFQ/87mx/OTmunn+iaHfzhe1qp9YLzarHi4/d TRzw== X-Gm-Message-State: AOAM5322NyMSy0YYYaMxZYwpmU90dqpPv5YZsGv2WNbAVL+6eDlJIvd+ NXuX2wea3cHL4lqJPkIST3gg X-Received: by 2002:a17:90b:ec6:: with SMTP id gz6mr1192362pjb.142.1605770010350; Wed, 18 Nov 2020 23:13:30 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 12sm5491577pjt.25.2020.11.18.23.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:29 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v3 1/4] dt-bindings: mtd: partitions: Add binding for Qcom SMEM parser Date: Thu, 19 Nov 2020 12:43:05 +0530 Message-Id: <20201119071308.9292-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> References: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_021332_480078_5B8441E3 X-CRM114-Status: GOOD ( 14.24 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) 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:432 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, Manivannan Sadhasivam MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Add YAML binding for Qualcomm Shared Memory (SMEM) Flash partition parser. Signed-off-by: Manivannan Sadhasivam --- .../mtd/partitions/qcom,smem-part.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml new file mode 100644 index 000000000000..cf3f8c1e035d --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/qcom,smem-part.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm SMEM NAND flash partition parser binding + +maintainers: + - Manivannan Sadhasivam + +description: | + The Qualcomm SoCs supporting the NAND controller interface features a Shared + Memory (SMEM) based partition table scheme. The maximum partitions supported + varies between partition table revisions. V3 supports maximum 16 partitions + and V4 supports 48 partitions. + +properties: + compatible: + const: qcom,smem-part + +required: + - compatible + +additionalProperties: false + +examples: + - | + flash { + partitions { + compatible = "qcom,smem-part"; + }; + }; From patchwork Thu Nov 19 07:13:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 328380 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2110:0:0:0:0 with SMTP id qn16csp117606ejb; Wed, 18 Nov 2020 23:15:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzROZZFpvHTFXdm1dNhJsrZbAIQPw7IAgqZBYZyBdYw92thOBYCapBUsDuhe7Ni73U9MtdZ X-Received: by 2002:a5d:4690:: with SMTP id u16mr8858504wrq.263.1605770103547; Wed, 18 Nov 2020 23:15:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605770103; cv=none; d=google.com; s=arc-20160816; b=0v3hpzuDkMTZ6V0nZ3bd+CtzsaxwGJ2fT4An6NOkqS7TYiZssOcUL1KLeucR+rQ3l3 WODuzBxRjOCg+EZDo5kcFvJ424TZT3oNmwNY5WJ4KTbe8UbmeWJBlCTnyDyEcjmyNuNa jaazeEkpyijU0vQUGdivuoG7cGBfmFIpzWeFNNpKPHN3IEBgDEK5R5GH+6y5IadXAk8Y rUSUGkcBQ9ou7j+uiR5HTW7eMNBQq3amEn9Qktm26Rimrx1fSKJXuXHRkgN2ZfTY2bxE FbEPPzSDoDJ5ukIAdsXXn7Q5t9yGrocCBh3VT8S/wDZDU5R8BMQ6BBcl0B5QybiGlfxZ +DjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=fVAuMpGcyARtsVTA98m0aYIX6x1jMW3sFaWMh7LFAx0=; b=rf7de+ZltNsB/w4R8ttArqh5r7+uuKvFet6nRjvAvtTB5MuoHUEyY1YGsNvu4KkMlO ASs6PFjpd+ETHhVPr5Pa/qoL8/ng3uu0i7vSgeQMympn9GhPJJaVGeLXoopIq3aQhG6I XyAF8Vjer/nzABGigWIpqCos88MPi4P4x7L74cM/oREkW2vVR4yRkkcwniIDVoVvaCi2 5DeM2wWwryfH01TvYDNL1mtxpTUZr/O8jIyJoEquaHtSY/CijvizusptjmUFuOjg3jqb Dd+Xtqnjw/eaa3vV668mNCkVGVr0op8ah8Gbf/Y04NIDLaTe8Y7dWK2NWK48Fhol4q6x XD6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=MDgIMEjS; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NSLVoJpG; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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 merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id a125si4212201wmc.4.2020.11.18.23.15.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:15:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=MDgIMEjS; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NSLVoJpG; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fVAuMpGcyARtsVTA98m0aYIX6x1jMW3sFaWMh7LFAx0=; b=MDgIMEjSni+vOlca7oUpkIDz20 6sP3Q1X+FlpijgOc+ua60xD1jjLooRgQI/0E/JzQzN2+z13GZ3WLyg2kiNAtgIv73Va7J7WWRl0MJ 90yadjnCPPwBOu3l28n4a31xWpNaR8+ag9CqEbKwogpBbj9R5GG5Ipa0oAWT/Piwxvhv/wx13pdSL TOso0m7Xe+QhxAP590mhRsu3mR0A/C1kezpCTBcoTKMbun9qTwXZu8AmFKW+NFhatbJJ0kLnmdPyf Y3d/9daFBC40+n2hzaGsuDnr8wlwT9BPwlypF8kxHU0utBnJc6OptZR7iPJfSoMB2a7MslHKwSzNY 90o3j/hw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8a-0005pS-Ku; Thu, 19 Nov 2020 07:13:48 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8V-0005nh-8N for linux-mtd@lists.infradead.org; Thu, 19 Nov 2020 07:13:45 +0000 Received: by mail-pf1-x443.google.com with SMTP id i8so3565840pfk.10 for ; Wed, 18 Nov 2020 23:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Gnr4Lc9H5rL0bCQqqKW7Vb766cS+ln5PIUs9S4xbm2k=; b=NSLVoJpGvJS0UwElq0mEoibDL0loh7TuPzwPh0hOxsWE0HqQtKwmh1YdbQbmzSFghu QkYAU0MLTOAEuzK/TSyDn2RrciD6vwTkGJ4cBbcRezhaL9sb7Mf1E6wbAWRo5Ca6WiVv lw91a4CcyrSvZ5V/GyfFJ2k6B7QUbQmtHQX6LatPleAg+TgSBZNSga+Pb0ytBK4bcY3Y xbClgCq5n3KDwX/OspuY9Diu8JkTFqRvYyiqzHrKcBlINsVSOjL5O/v6vDrGbXZI3bNn vQwdIWQO7XnS1vQDH6ugyZL/gKeIdIUBW79uNRsUnyNHnh8o5lFmsaigO2i7f0oamOxf bBFQ== 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:in-reply-to :references; bh=Gnr4Lc9H5rL0bCQqqKW7Vb766cS+ln5PIUs9S4xbm2k=; b=p6xX6j96rVwAAVTSJTWt55Jhb2ySVcakzRl8K6kufhcefHyJvsyWmjZaDVW1fN50yy WzqYCUjYjKKlWuYsjAX85ltfb6GlpZooiotnuA+hqT6+eXgJyMpf6jVJmnltdqXaX0ic T5VRKjURaiYMsc8gYGKqRfBYoeFa0nJ+Ns2BYdDJJirtAo76Drh7tEgr/53ojAcGrZIw rwWosPzjvUfiDhYAa+iFPJ7RodzbNi4gZHJ5aZUIacDm2Tj+MyC5VVC5OEGXkE/V0GFo DPMWor8CQG9VkwGwHGOQILBDWwbnzIMIM7EEp37Zpf6tbRZJmACJ9QYM8eQnlrKNSVcy Phog== X-Gm-Message-State: AOAM531jDYRcWDMjsHzyk/s4BmqkSs/XalRbr8A+72k3bSuzEhQ9Geoo 2GO9tlTACMlepEymRA6yjiTM X-Received: by 2002:a63:d70b:: with SMTP id d11mr11165251pgg.94.1605770013939; Wed, 18 Nov 2020 23:13:33 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 12sm5491577pjt.25.2020.11.18.23.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:33 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v3 2/4] mtd: parsers: Add Qcom SMEM parser Date: Thu, 19 Nov 2020 12:43:06 +0530 Message-Id: <20201119071308.9292-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> References: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_021344_290788_DF2BA9D6 X-CRM114-Status: GOOD ( 25.91 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) 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:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, Manivannan Sadhasivam MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org NAND based Qualcomm platforms have the partition table populated in the Shared Memory (SMEM). Hence, add a parser for parsing the partitions from it. Signed-off-by: Manivannan Sadhasivam --- drivers/mtd/parsers/Kconfig | 8 ++ drivers/mtd/parsers/Makefile | 1 + drivers/mtd/parsers/qcomsmempart.c | 170 +++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 drivers/mtd/parsers/qcomsmempart.c -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig index e72354322f62..d90c30229052 100644 --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig @@ -160,3 +160,11 @@ config MTD_REDBOOT_PARTS_READONLY 'FIS directory' images, enable this option. endif # MTD_REDBOOT_PARTS + +config MTD_QCOMSMEM_PARTS + tristate "Qualcomm SMEM NAND flash partition parser" + depends on MTD_NAND_QCOM || COMPILE_TEST + depends on QCOM_SMEM + help + This provides support for parsing partitions from Shared Memory (SMEM) + for NAND flash on Qualcomm platforms. diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile index b0c5f62f9e85..50eb0b0a2210 100644 --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o +obj-$(CONFIG_MTD_QCOMSMEM_PARTS) += qcomsmempart.o diff --git a/drivers/mtd/parsers/qcomsmempart.c b/drivers/mtd/parsers/qcomsmempart.c new file mode 100644 index 000000000000..808cb33d71f8 --- /dev/null +++ b/drivers/mtd/parsers/qcomsmempart.c @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Qualcomm SMEM NAND flash partition parser + * + * Copyright (C) 2020, Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include + +#define SMEM_AARM_PARTITION_TABLE 9 +#define SMEM_APPS 0 + +#define SMEM_FLASH_PART_MAGIC1 0x55ee73aa +#define SMEM_FLASH_PART_MAGIC2 0xe35ebddb +#define SMEM_FLASH_PTABLE_V3 3 +#define SMEM_FLASH_PTABLE_V4 4 +#define SMEM_FLASH_PTABLE_MAX_PARTS_V3 16 +#define SMEM_FLASH_PTABLE_MAX_PARTS_V4 48 +#define SMEM_FLASH_PTABLE_HDR_LEN (4 * sizeof(u32)) +#define SMEM_FLASH_PTABLE_NAME_SIZE 16 + +/** + * struct smem_flash_pentry - SMEM Flash partition entry + * @name: Name of the partition + * @offset: Offset in blocks + * @length: Length of the partition in blocks + * @attr: Flags for this partition + */ +struct smem_flash_pentry { + char name[SMEM_FLASH_PTABLE_NAME_SIZE]; + __le32 offset; + __le32 length; + u8 attr; +} __packed __aligned(4); + +/** + * struct smem_flash_ptable - SMEM Flash partition table + * @magic1: Partition table Magic 1 + * @magic2: Partition table Magic 2 + * @version: Partition table version + * @numparts: Number of partitions in this ptable + * @pentry: Flash partition entries belonging to this ptable + */ +struct smem_flash_ptable { + __le32 magic1; + __le32 magic2; + __le32 version; + __le32 numparts; + struct smem_flash_pentry pentry[SMEM_FLASH_PTABLE_MAX_PARTS_V4]; +} __packed __aligned(4); + +static int parse_qcomsmem_part(struct mtd_info *mtd, + const struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +{ + struct smem_flash_pentry *pentry; + struct smem_flash_ptable *ptable; + size_t len = SMEM_FLASH_PTABLE_HDR_LEN; + struct mtd_partition *parts; + int ret, i, numparts; + char *name, *c; + + pr_debug("Parsing partition table info from SMEM\n"); + ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len); + if (IS_ERR(ptable)) { + pr_err("Error reading partition table header\n"); + return PTR_ERR(ptable); + } + + /* Verify ptable magic */ + if (le32_to_cpu(ptable->magic1) != SMEM_FLASH_PART_MAGIC1 || + le32_to_cpu(ptable->magic2) != SMEM_FLASH_PART_MAGIC2) { + pr_err("Partition table magic verification failed\n"); + return -EINVAL; + } + + /* Ensure that # of partitions is less than the max we have allocated */ + numparts = le32_to_cpu(ptable->numparts); + if (numparts > SMEM_FLASH_PTABLE_MAX_PARTS_V4) { + pr_err("Partition numbers exceed the max limit\n"); + return -EINVAL; + } + + /* Find out length of partition data based on table version */ + if (le32_to_cpu(ptable->version) <= SMEM_FLASH_PTABLE_V3) { + len = SMEM_FLASH_PTABLE_HDR_LEN + SMEM_FLASH_PTABLE_MAX_PARTS_V3 * + sizeof(struct smem_flash_pentry); + } else if (le32_to_cpu(ptable->version) == SMEM_FLASH_PTABLE_V4) { + len = SMEM_FLASH_PTABLE_HDR_LEN + SMEM_FLASH_PTABLE_MAX_PARTS_V4 * + sizeof(struct smem_flash_pentry); + } else { + pr_err("Unknown ptable version (%d)", le32_to_cpu(ptable->version)); + return -EINVAL; + } + + /* + * Now that the partition table header has been parsed, verified + * and the length of the partition table calculated, read the + * complete partition table + */ + ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len); + if (IS_ERR_OR_NULL(ptable)) { + pr_err("Error reading partition table\n"); + return PTR_ERR(ptable); + } + + parts = kcalloc(numparts, sizeof(*parts), GFP_KERNEL); + if (!parts) + return -ENOMEM; + + for (i = 0; i < numparts; i++) { + pentry = &ptable->pentry[i]; + if (pentry->name[0] == '\0') + continue; + + name = kstrdup(pentry->name, GFP_KERNEL); + if (!name) { + ret = -ENOMEM; + goto out_free_parts; + } + + /* Convert name to lower case */ + for (c = name; *c != '\0'; c++) + *c = tolower(*c); + + parts[i].name = name; + parts[i].offset = le32_to_cpu(pentry->offset) * mtd->erasesize; + parts[i].mask_flags = pentry->attr; + parts[i].size = le32_to_cpu(pentry->length) * mtd->erasesize; + pr_debug("%d: %s offs=0x%08x size=0x%08x attr:0x%08x\n", + i, pentry->name, le32_to_cpu(pentry->offset), + le32_to_cpu(pentry->length), pentry->attr); + } + + pr_debug("SMEM partition table found: ver: %d len: %d\n", + le32_to_cpu(ptable->version), numparts); + *pparts = parts; + + return numparts; + +out_free_parts: + while (--i >= 0) + kfree(parts[i].name); + kfree(parts); + *pparts = NULL; + + return ret; +} + +static const struct of_device_id qcomsmem_of_match_table[] = { + { .compatible = "qcom,smem-part" }, + {}, +}; +MODULE_DEVICE_TABLE(of, qcomsmem_of_match_table); + +static struct mtd_part_parser mtd_parser_qcomsmem = { + .parse_fn = parse_qcomsmem_part, + .name = "qcomsmem", + .of_match_table = qcomsmem_of_match_table, +}; +module_mtd_part_parser(mtd_parser_qcomsmem); + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Manivannan Sadhasivam "); +MODULE_DESCRIPTION("Qualcomm SMEM NAND flash partition parser"); From patchwork Thu Nov 19 07:13:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 328378 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2110:0:0:0:0 with SMTP id qn16csp116870ejb; Wed, 18 Nov 2020 23:13:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/NL+m3yAky/KbI7PzWJyEXDGjm/fdOLIp3+26A04ectQZTuSOJ7MSSw32zAPSQxnEpQuW X-Received: by 2002:a7b:c4c3:: with SMTP id g3mr2741447wmk.127.1605770036247; Wed, 18 Nov 2020 23:13:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605770036; cv=none; d=google.com; s=arc-20160816; b=S9kwN7Tg7DjplYyu4TgT+XngImFlZVodIaOqgDrofkdUT2t+qSy7JmhPTjmq/NDgeX wXAzflzwRL2UErAaeweaxH4YKtXodZ/WcRVgX4PH9xylbMBdb40qGwsuPz6bn6RK8wXT kxPyUBwlKtwjGn1UbVe65bqMt2qgwc8iiM2BiiKMfrhxV/cT0TiGU0yxTpmmfnNiewpF 4ZNSqestEl4HbC/5UdI9Fpx30DFgQf8n6VAfbQC/j2RvTpZCGDGYqIxTa3forRafpJ22 IsxgC/eVbHRqgpVULpMG7wtfExD8Zxn2K+lRnsXuC65Lye6TBjbnMJphoCW5UfkBuBKg I1ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=CkF2v/dgvVgwxcdljHkdzy+a5LOvXUP/aOz8PPRkrjw=; b=PYL+f9euGWTautVWjQhN1dP5tFD3SAA9l/+YsvPOqINtC7cBdqntHgo5p2qBnxtqvy h931wYZqurj4Pctr5nW5Bg3/wgxqlKolEe0MakXEauBFlxdlsQidvFn+4s7io6Dt/JP3 XFb4RGXUcn8wSVEw4bHolmguS/kL2fuGAoiUTbgEItkP6V6ziyHKNUjgaqANO8bsyZ1E MYJLbyrA7iPhVXhkcsljaxCUwgZ5qDCjNN9lEkFYTnDA+DsDORx0Rx1h82ck0wBsm/Zy 9xjMvOHZUL0ZExw5KRcYdBGZJZIEu5ZxQR39txF8CqdXb9TZQopigS6Iqxlj8gKNeCtX b9YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=xWdgKho5; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="G/p2/8Tg"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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 merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id i9si25723063wri.462.2020.11.18.23.13.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=xWdgKho5; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="G/p2/8Tg"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CkF2v/dgvVgwxcdljHkdzy+a5LOvXUP/aOz8PPRkrjw=; b=xWdgKho5LwGT9rMrW6r7wSsFTm puIaDQyZe2/IHBJOiFUtNt42Ct7bcP55dBOgOuojooqpyvp+EMPV17fgJsufxlS5tW5oC1MTJyq7n m3f13m9kOhCOFpP/bYmH6OnZD3D76Cw7XM6oms6T6rurqJqsN27GCJRHfmgQ0mo7y+ldq8KGs/mCo oELw0IJB843vJ3REHtImXcN6ICGJk9HvvdXARuK7zEMfVF1OpuYaDKYbffjo618mWe44IwTWEH5O0 /4GWhzDRx5wgLKyNDvsJhPzJtpaing6TyPZ997EfDKClwhW2d8YGRgDBJE3MivoOopN8V8Mbw9gOB n0FTCWWQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8Y-0005p7-W6; Thu, 19 Nov 2020 07:13:47 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8V-0005o2-8M for linux-mtd@lists.infradead.org; Thu, 19 Nov 2020 07:13:45 +0000 Received: by mail-pf1-x443.google.com with SMTP id i8so3565958pfk.10 for ; Wed, 18 Nov 2020 23:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=268k75iGgPwajGOaY5d0Of03PhQtD6bYvRMlc9HmW4g=; b=G/p2/8TgOM+86w/05s8sQwFulz0SPcg1s110p4Y5VrMY53CxA7P1YrGyKhG8Hcevmo x9+HHdxGxVPrZLI4GxC6iCh0/mFSGTuBemeeyhMyrNbER+aYPclv7+p6GCoqJG78exmw PDFtAvEB39hnhS5L93Qcpd8rN78NDXuOfrhqiZ35SwzNfVlggchfM0dU32bXJqPBZ1xw xBBNh2DoMA7Jz/nIDF/yTCjNVpeHN1GFVV27NasRvn74NQPSUhEYLd3RHqT25M5m/5qY IxxklrtsQOjw5puK4oiO+NlbTzo53b/XQfORfU3bN4vppwxzT4M4uKMy6TTVLPeFzx0i hYQQ== 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:in-reply-to :references; bh=268k75iGgPwajGOaY5d0Of03PhQtD6bYvRMlc9HmW4g=; b=mR8cb9585fa/HSB/SiCIJsyc9duD8ZE1aHbrH1BR5GntsTQQ0VlXo/wyXkWpv/7NV4 GlE42DHd1R9mrdIQEzvkhwWEV4JC/kFwnbqt2JohOY9uekG7eo0qVM4wava0xyD8ZclH ORLhJ9WkbZSLhyUM3CqjC4fKUMGeHUwzYL7i+hwUFRxdv7i17FLnxW9TBH+EbjivmC3e SWr+2isWOB+c7jqdqXCPABr4V4i/cYG+w9FUBrlGn49shYjjnvsIfYJB4CDlrW0wmhms lhfLQnoeFM3BF1myRmBENnsd62TOKyQgc66aDbnu9oAVCoq3sjN0rRzjH54reDpj29LY GU0A== X-Gm-Message-State: AOAM5319xwzPL3gcwU90NTyf/Ra8P6ps45Y9DgSfbTBOOQbjkMuxAoiZ wg1rxlNFpZZ+tLsS9KHHgiMtNM8vwiTX X-Received: by 2002:aa7:9af7:0:b029:197:bfa8:abaa with SMTP id y23-20020aa79af70000b0290197bfa8abaamr646747pfp.26.1605770017530; Wed, 18 Nov 2020 23:13:37 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 12sm5491577pjt.25.2020.11.18.23.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:36 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v3 3/4] mtd: rawnand: qcom: Add support for Qcom SMEM parser Date: Thu, 19 Nov 2020 12:43:07 +0530 Message-Id: <20201119071308.9292-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> References: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_021344_188159_3177E5A1 X-CRM114-Status: GOOD ( 14.05 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) 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:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, Manivannan Sadhasivam MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Add support for using Qualcomm SMEM based flash partition parser in Qualcomm NAND controller. Signed-off-by: Manivannan Sadhasivam --- drivers/mtd/nand/raw/qcom_nandc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index 777fb0de0680..1b031aeac18b 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -2797,6 +2797,8 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc) return 0; } +static const char * const probes[] = { "qcomsmem", NULL }; + static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc, struct qcom_nand_host *host, struct device_node *dn) @@ -2860,7 +2862,7 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc, } } - ret = mtd_device_register(mtd, NULL, 0); + ret = mtd_device_parse_register(mtd, probes, NULL, NULL, 0); if (ret) nand_cleanup(chip); From patchwork Thu Nov 19 07:13:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 328379 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2110:0:0:0:0 with SMTP id qn16csp116948ejb; Wed, 18 Nov 2020 23:14:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyD1hunwTSTs8huUUE2EcmFaqG9XWAEPQEWKlNyydT9HKcKeYWSDUlzWaRqaJoq0vgYRNtQ X-Received: by 2002:a5d:6506:: with SMTP id x6mr9141330wru.175.1605770043312; Wed, 18 Nov 2020 23:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605770043; cv=none; d=google.com; s=arc-20160816; b=NGvAOHqlIkDYgmA0k0FNh4PS1GKDRzry5Xmcj9rtRpLIdMzLVyxBtUfofC7ESXJMJx JbAVHAEEPS2UPQoEHrdrfpu+h66wTQMCXUzVz519pxNjhVFTRJ8VMDMNGzgMXC7KmgG+ 0sPvex4+EjTv7o2tY2MqYB/rjOczYqU+/TGgdUlnCCTOpTBub8eWamGxYYDVhI/QMVh+ rn3B+3HlCzi6HMTBMemQkdbeATZYbhytwPK4PuD4307WyMtHEMJ3v9/tZUXdaRz+RXOc cxiIYmCt9C+ngTzX8JWY17Kg8M/NWLHlhYa7+mVZi/R5VpWuwEbuS8uBmvjWO0Dx+k7/ C5Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=EJXX6BpLckPv7T3dPcAMzIc4MlFYYxN8MtLccvSyM+0=; b=PH7b6FlA/YDOhLzzRQRrdOe5TgSjF4tnTfeWe6HmnOvJeuFinvHTIkhMAkp+SkfM+b s9tx7TnzO0HwXhR0dKiXT9KTQAY0hXc+DXUcJwctvThiJTjE2EhRptHJZxR3d+GQyiCo L+BbItI+tQYd/1wpxdOCDaKoSVka9FqkbCZ55ldfabvD0Lo5/C9nL55yGt9s/dxLou4K plNVAU+aOa0/SA7jAY4FStp2wyVVyb21y9nmSA0t7Rh9wEPck5yAZkqGLM1ZPpfd80HJ bNq/7XTlrujtGhdaXVAYrJTsNlqsip9P3r3TTOCM9Its6uAE7G2wFvf9/xVqdPanFeeH lJ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=DBh+m0Aw; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=qgWlpJRt; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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 merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id f7si582323wrx.332.2020.11.18.23.14.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:14:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=DBh+m0Aw; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=qgWlpJRt; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EJXX6BpLckPv7T3dPcAMzIc4MlFYYxN8MtLccvSyM+0=; b=DBh+m0Awalo0kxm72eWUXnGtE6 XZQTQOY5FOpd6vZNxor9YRpgQ1pzmj281cRdIbiUesbEN8x0m51KBtOkS2BDSaPZewXp5qK8a+klA OpU/aUqd2NSGA5loHL5cZ6qtry2O9q8TuPTlmv/sJIomvPAOH62o80zN9wcvd0qPx+vQVRaG6TgGm GrCoJwUEbB5c6WJTmt/I3Y0jNixlnSNcp+LoD8KoR0rw1Mr1SqN60JO7TmSYJoGiFPdv9ttLtZw4I wNi4E1nxhGsm6dA6dKDsHTQnlKE+3W+2qHTirok/5/ynPWplRQm5fmdJnpgiNyMn/zO9GZOSBZ+tr lbhVkVkw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8f-0005qE-S1; Thu, 19 Nov 2020 07:13:53 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfe8Y-0005o9-2J for linux-mtd@lists.infradead.org; Thu, 19 Nov 2020 07:13:46 +0000 Received: by mail-pg1-x543.google.com with SMTP id 34so3390151pgp.10 for ; Wed, 18 Nov 2020 23:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aapWpWlyJG4BRZvNWpxnSiKXabtbA1WEoNDKMnXBWMg=; b=qgWlpJRtvQvY++Dn2/UpaiG/tLsPm+RlkTuBkKurklKGiW6comp6026pG/rrJE5H9s Jvk8jJuWq4Rmp7o3owcGR826LFXlnudvx23sSDp7tOXziagznab4Xu/yqFRqW91nuLpg oddCSmZB+jJQZcvwEZy+kadZpuFNxNRVyHJOXrjEsjC3XSrDx5kYfxTW9YHmyjS9YH5o sgRWaev0MOcbaeZrDF5y0KNkiRpi/kko7dycJ4xxtMSLRG1WgLOpHPXTmUa8T0Lwj487 Z2bzhg0NQVo1PhiaH/PrUtoyRFbTUM47fiwe92cnxelpWzoWVcdqwTR5ci+L8dRHwkQR Ixgw== 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:in-reply-to :references; bh=aapWpWlyJG4BRZvNWpxnSiKXabtbA1WEoNDKMnXBWMg=; b=Pk7mMeK2aMIjjRjjScn6x07gjCIdwa4gqfNpVDn75+aPO2tFnpAvcHNJ4cEfYfDzxh zDxxcSzJk7yw9FHvceei9IbOiYG0Uu8QcFYVk6a0q0nXKakf61vUTEV7s+f6Tlk4O9B5 8pHMN+T6t1N17S11Eb4iONvqLDrPc3qf+ljaoBhmoeFv5a0Iu8o54gM5Zep7gU27wL1E w62J7jvZXw438wEej1U8IPAz77DbX/Ot2Xqs0YRxVoxxkEzKgEKJNiC4/6skMYNyosYU BGDTOI4geev9IX9iJrKi3DgAA6x4o4EfGwGte+Cnz6DsANfbU/QBREeJZQoO5rgdjPrS wIag== X-Gm-Message-State: AOAM533nmtCaO93AY5kyHvDydF0ffp3mTKc+SP4xMjnFoucPfzRFJQJ4 IHhr+x8xfFxLrpYMa/G0khru X-Received: by 2002:a62:8608:0:b029:18b:a8e:ee9 with SMTP id x8-20020a6286080000b029018b0a8e0ee9mr8008802pfd.65.1605770021344; Wed, 18 Nov 2020 23:13:41 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 12sm5491577pjt.25.2020.11.18.23.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:40 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v3 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Thu, 19 Nov 2020 12:43:08 +0530 Message-Id: <20201119071308.9292-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> References: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_021346_180596_0FC15EFB X-CRM114-Status: GOOD ( 14.30 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) 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:543 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Linus Walleij , linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, Manivannan Sadhasivam MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org In the case of failure while parsing the partitions, the iterator should be pre decremented by one before starting to free the memory allocated by kstrdup(). Because in the failure case, kstrdup() will not succeed and thus no memory will be allocated for the current iteration. Cc: Linus Walleij Fixes: 1fca1f6abb38 ("mtd: afs: simplify partition parsing") Reviewed-by: Linus Walleij Signed-off-by: Manivannan Sadhasivam --- drivers/mtd/parsers/afs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/parsers/afs.c b/drivers/mtd/parsers/afs.c index 980e332bdac4..26116694c821 100644 --- a/drivers/mtd/parsers/afs.c +++ b/drivers/mtd/parsers/afs.c @@ -370,10 +370,8 @@ static int parse_afs_partitions(struct mtd_info *mtd, return i; out_free_parts: - while (i >= 0) { + while (--i >= 0) kfree(parts[i].name); - i--; - } kfree(parts); *pparts = NULL; return ret;