From patchwork Tue Nov 17 17:48:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 325521 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4369393ils; Tue, 17 Nov 2020 09:49:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+jLvJIOI2XNj1Go5MeecqfUep8gbfmjjjfQM2XkY0Sw4qxYFSZxmEDYHkOgh07lGHfU1B X-Received: by 2002:a7b:c391:: with SMTP id s17mr275629wmj.66.1605635355662; Tue, 17 Nov 2020 09:49:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605635355; cv=none; d=google.com; s=arc-20160816; b=y8aMNd0G8X4qn6Uh/leBe6MTKn/pt/tKGieclNlMl3woWFl5E5aHJFRj5TAfKahDEM cFYYypPEGeI87Ax6zcqY9kSkZnOm1iUAIrARvtJ7mnTOSADSBGoEjznq0g4Jadg5qvJH T9dwsQZK0MnJUCmX0MykBE3sI/Fy/+ZDpDJXI4+5eHDVKWxJ6vQKsfq+92RfLe6dBBT2 uoMYQAhYmr/8CcgY1mDOwYJjAdNnKu6OeyKG4UgTSlMNsb7Z6sfn4viQnMs/Nj66YbvB keKr2q2F65zP3HkXAu5HOkjejLdH7KhJLpvdfIjyPxxou0bhbTAjKrjxKpICdBGhZqMR k6mA== 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=PTxVktPKuo0rgwwmycGLg35a0MAiuSkPvB5oVPUHEYZuypict2KqlYdlUNlAEXKuRM MMbMU4ctRvOTSqxJ1D6JDnzlNVUAmfIu9CXhN78i6y70Q/nR+px4fjq+hyCy/vPiLraR hKRNQs3su8fb1nBDwLujY+e/zcRN6pMqE69JXvOLqYjd+Lp3We8Qzm4opjRR3eYwQ0qF VbrH0Ah3uGc8Shf8H1Ie2B1sXEr1v7/cIoyI+yzimXzBUnMOcAWcSUbWYNElLMbfpNB+ Ba9zIsiky8oUxQWEbiDpMpLOLZXyjm8GzIoaVbIq/dJUlMNx/Vw2o2mA4o4eu8cRq+OS hzVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=JLOr2YXx; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hkLaoiz2; 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 b12si20827141wrm.335.2020.11.17.09.49.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:15 -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=JLOr2YXx; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hkLaoiz2; 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=JLOr2YXx34gJIKY2jrH9RtZMKI u0n/quTcLPcP7QyZGkamSeMav0AwmBb4vDDamscCrBvd6MnLrk0RDnb2W6f/XsllEVBbaylQDDfeQ klEefqrbRskoCOt9y8EZSPydEvDpwR9ljtdaibKzZfnQTK2KXI7KSIUHOiDzUiEVy+mVm04InAm7D okAXN/4lUErxXg1pnGuo2nrsrZWjojCaRKpNK05yz+BjXk4rvQNXUgF+NUFfTXQIo0ZL51ymAe0Gg TwrGOS7gF7lDb0rVOHQeDKucRDaN4oTOWU0vobkh+2eY8iEL4fJN66hgNNT744lq2oA3qRxX+6Ws+ R0+BWcsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56H-00078J-L9; Tue, 17 Nov 2020 17:49:05 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56E-000774-FE for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:49:03 +0000 Received: by mail-pj1-x1036.google.com with SMTP id gi3so912901pjb.3 for ; Tue, 17 Nov 2020 09:49:01 -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=hkLaoiz2lCG8tln82zm7qfOl0cDYLureyURBuaXH0PW+24+gvVK577hO5cNqI/F2aV +GzMDYmWlne/pkBM+dzDfJnQpgrLbniED7sUDitRpnxxKZjuzR8aLV0dYiozsnsOmwn1 9UHgFxx1EGsPczmBiB4PDynbbKEf8EDnIK5/jsO+eUuGGwO2CW6vU/uolWJExRUfW0Ig G4Fn3d8qgVU/z/93B6Yaq4oInZigk7lXpZpyUcXiaajbhasY2FeLedNhRlai/r3pYYrb XXb4u2iaMe7ReCIl9scVlGdGRvnn7UWb7invf8vBpD0I8VswVGhoBQLc5gUaHPzdyVph yqCA== 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=KyDVjW1l+sN3BTPRDHkaDB1VeXpaRZN79AMMCT0oV143dSkdQ4hhuuGU9Vy6zKtv7c IVj/q6MWbK401qdg1YF/d39Tn5UHz/7zk9p3xYxGs99ohMU5cOLLTG/0zIgbpWBl8Ue6 FiyMJuzj2pN04gPLFnd0c2JwDUo22Vb1fj1n5njMlBzowyxftm6J7yX5+zdh7wwrk44o QrmXUkS6h1McrviB0bkqa6X/icKXhQdnwOeO5N42VS9wGJC9mKSz5FMIhwgnFN5jcs9Z c9CmeviTnOBa/oLtrhrLyZzYWEYx2QxkLreaU+BgVyN8Slzx5+uL2t1ZfSkwF1IFtUo9 UEYA== X-Gm-Message-State: AOAM531qxLufCQDyZHn3K8EMjDdsG74rKe3VISh0qrW6NTkHocIFQQ5h CpqWRHyE1vGq7P0YgkIEDSyj X-Received: by 2002:a17:90a:1b44:: with SMTP id q62mr201421pjq.59.1605635340003; Tue, 17 Nov 2020 09:49:00 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 192sm22222810pfz.200.2020.11.17.09.48.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:48:59 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v2 1/4] dt-bindings: mtd: partitions: Add binding for Qcom SMEM parser Date: Tue, 17 Nov 2020 23:18:42 +0530 Message-Id: <20201117174845.28684-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> References: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_124902_561870_BA82DA64 X-CRM114-Status: GOOD ( 14.29 ) 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:1036 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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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/ 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 Tue Nov 17 17:48:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 325522 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4369440ils; Tue, 17 Nov 2020 09:49:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyg2lWohMdCh+P6zBukffO5p4Qw8YkghmS5A0baghOWjwBdNFGSGpAGoTiHCtZzr4HUTUFf X-Received: by 2002:a7b:c937:: with SMTP id h23mr232182wml.19.1605635360519; Tue, 17 Nov 2020 09:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605635360; cv=none; d=google.com; s=arc-20160816; b=ATLK9vy+anxbUZZ8T5DjABdaIBlhgWH/4f102Pl5DxUbe6Ab1yBFJXqheSx7nczntL aRxP3CjohveyKE8WfFJjmGp75qyn3+JJjJOiWU1c3MjhZuUB2LXn/pSSjTWFp+o222np HBgs96PezgcE8IC7103l63aFCyZFw8b/oEZgTXFxFXkLO8uCtAHKbpUcbHrF+rd5qw85 gVNTLiVc1gucJzVY9UggGNWvAbcqOMlIxDirtzuNECXUV6OT17jftNXms5RwJi9/TQPh 0eeweGsGi7UImKFFSVHCfZ+5yjTQdmrdlYfArsRPxIoIhXuJjTyD1bLCxzo4Y3KLsFiD MzRA== 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=AOlK7cdiM9g1FIXpnmkTtLRvYobF59JqXT15lseeokI=; b=BZy5jviosebvq95ZrNc+G1FJQBOJuOfO/lNsE57JHXG9XV49l0Xc0e/ZBlfOZp2juG 8OgUnZ64IIq+rO2rfMhcMHyUef8XBYz4aHNbJE+qs9WLOXPM0m04Ait5fjT7YDwKcV3b WtVWWG4rIr2ZP+4A08R2MiK9uYKXwCMs3Y7++MT8iredf9PGVJ5TPWBh7zc9+hJIUiYW jFiTIkyDHHlyr5JTxsuR/V89XAI1ePVrQaZeoxeA+WpCDwwsqE3fB5QbJKHBWHYc27pU u4tk/sQL+0LSt5a0WY7XZaZWWFBEMFiZ2B+H5FRlq/12mFWX0d87+6oAqaVLLEF5P/To o/rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=LxGpbHVG; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=oLrhMKn+; 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 b65si2929200wmh.213.2020.11.17.09.49.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:20 -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=LxGpbHVG; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=oLrhMKn+; 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=AOlK7cdiM9g1FIXpnmkTtLRvYobF59JqXT15lseeokI=; b=LxGpbHVGyxgNiE0WrCwr9VmO4d MpJdm2tKUAVtYsXzHi6tHhd/Xw+uZFGoqHIKn12jP3I5ibp0i47sI5vf1HqRXrPOmcBE9WCebqhC4 ckpVxiW0dYtAPkPVtqGqIEZzhsn1j421Rqxs/i++yu5ul5ggOYFsH1Z3/HVGvPeeXnGstXXOqn18Z XCgZ+5tNuNYAodI8ryGv0iky9sSvLYXJ6FafQlF4UnxMPUbah55bdzgJXXuB69K5vj4ADvqOcKufV 4zwavoqrWkjR0JTbVZ9IBCtF4CTtXBXG8LL+laXj2zz6mAe9iv0OmVifMKldIEBw+9mJF9zY4VzrF OYUULTfA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56N-0007A8-F9; Tue, 17 Nov 2020 17:49:11 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56H-000786-MC for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:49:08 +0000 Received: by mail-pj1-x1043.google.com with SMTP id ei22so913302pjb.2 for ; Tue, 17 Nov 2020 09:49:05 -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=XZq3LdMiBAVThwX/6HfimVVHNbrtDf6lTNLc0V2ON3o=; b=oLrhMKn+ofvpTeXUIdKLvesFzJ2G+ZtusoskStBzxx0N2G2mQzG6iN66SSwo3M09Lj JQvxqDDkmjdk1iHqVBSyiuAXkGnLAyKuBTnMRcwD3EvFVrO+mS4X6wOGqrTrROS+kDa4 ITwPvPoL27fkTErCLqwx7FQKvFMzy3Fq3YhukC+7tbVEdrbA+EJuMJX2TvWkeLdZIxRG teXaChgI5GNQy4NvX6LaJq9cUz6M9HoWA7r46gZy0XBKkT+SBujj5hYUdS3rha9hMMVP pZ8JE/PrFgAURGKg+fUycxJIlLtn1eE8BTxALh2Jt6Ie9km/cF85GXsIn9iVBmPKN0n+ zYeQ== 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=XZq3LdMiBAVThwX/6HfimVVHNbrtDf6lTNLc0V2ON3o=; b=cD7ZdOkCu5S+NVaHD74dxmrtaopZOl3ZtlUwv0qlb5p44aw+QptLLRtQOpcQM7msAh 2zOheUMMwdDaHES2VCnNcT/IQwMx65PvJ/KeCDtz0wxU/pDhqmH0+3QyjTsHP9vD3BbV bBoH+Az7j9qd2ja0QzabncHqvvZ+U9TmZvNO+c+JvVGE2yt9oRVqNOQlptpwmJkXLXbE mxsBzBPaEDvBVTVeCechyjQ52fy6E2S8xbK6hYC/L494rnO+teaTmwRzaIG+G90cEuSY Wsvkocu3xWH/w61n+OuI/HuBc/s1fEXu9353rHmfW7PdC7w+1jYWTlbuMI/GYINUyTxK 0rUQ== X-Gm-Message-State: AOAM531MEQRAoabHzO9HCV2MRakKQp4A0W5d1LJG73om/vkhrrckHsFh pqdYEx5L5l+7NVREwiehHDEm X-Received: by 2002:a17:902:7c12:b029:d6:ed57:fe13 with SMTP id x18-20020a1709027c12b02900d6ed57fe13mr543653pll.59.1605635343686; Tue, 17 Nov 2020 09:49:03 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 192sm22222810pfz.200.2020.11.17.09.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:03 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v2 2/4] mtd: parsers: Add Qcom SMEM parser Date: Tue, 17 Nov 2020 23:18:43 +0530 Message-Id: <20201117174845.28684-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> References: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_124905_795948_EF212F38 X-CRM114-Status: GOOD ( 26.17 ) 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:1043 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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 | 169 +++++++++++++++++++++++++++++ 3 files changed, 178 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..d8c2a3fa4dfe --- /dev/null +++ b/drivers/mtd/parsers/qcomsmempart.c @@ -0,0 +1,169 @@ +// 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]; + u32 offset; + u32 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 { + u32 magic1; + u32 magic2; + u32 version; + u32 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; + char *name, *c; + int ret, i; + + 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 (ptable->magic1 != SMEM_FLASH_PART_MAGIC1 || + 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 */ + if (ptable->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 (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 (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)", 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(ptable->numparts, sizeof(*parts), GFP_KERNEL); + if (!parts) + return -ENOMEM; + + for (i = 0; i < ptable->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 = pentry->offset * mtd->erasesize; + parts[i].mask_flags = pentry->attr; + parts[i].size = pentry->length * mtd->erasesize; + pr_debug("%d: %s offs=0x%08x size=0x%08x attr:0x%08x\n", + i, pentry->name, pentry->offset, pentry->length, + pentry->attr); + } + + pr_debug("SMEM partition table found: ver: %d len: %d\n", + ptable->version, ptable->numparts); + *pparts = parts; + + return i; + +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 Tue Nov 17 17:48:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 325523 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4369525ils; Tue, 17 Nov 2020 09:49:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMpxmwShdHtk1a2bsaAgXFmhAsyVrP8p1797tK7UXGAnpd6ZQrZ74QTqfuIkUl3JigxKFB X-Received: by 2002:adf:e484:: with SMTP id i4mr713691wrm.398.1605635369062; Tue, 17 Nov 2020 09:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605635369; cv=none; d=google.com; s=arc-20160816; b=QKkK0X04yPjVSqRFO94S3MQtbWd1csKIhiGoVSGf+1soU7YFKgRxvlhG8B/se/Ulu8 Y5LShdQX/FMytLgIq7ulKk1dEr/elLv0EqMPTa6emNmU4gd9dY1zo71erunY6h/KhtfB t293dvQI+4dCTasYamngp6bYteZWc1ACAI5DSNaPMlTHHbx2EEtitVls/GiH0wv2kW10 yOLySKZPJL44MKsp8Cy3/TYLYNJ5oOC+8cFSNHUZrFQ2FW4QEk9Dtj1jLGSrZOW1dnPo DpASETD9wkx8hpe3t1zqRkmm176iZU4EycOEOUAfkQmcZqAk0qDim71qUX2KY8Nx2UEf 5pYA== 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=YlPwH6i9Ny9WHFhhqPOSTRIfeUXs08y2UmwupR/5hbv4SZq/qX3U3RFqwv1j3iDVLg sLbKil2SB/fDvn+8eEfZbjPTshl8GGqgk6LDFf4s5m13OJUpEQ38MYijMPgBd1l3uU2r p3IH1cq4+qzwfwhh6Mga52B+gb217qNUkWYawSCM5SqvR2XhfnHvYXdzx0SkQ2ymaO+5 yicHat8h2twr0bySD2pX/CKWQIUXXDAuZGEPOBXcvB69o9skIkJdrq5xgbn4kO92cwh3 Bie+XwdAr2hwIcMJfhiGUjYq3N0gDKC2dVkaP4feXIdz3eCEjVM1U6tpo4W6Rduw8LzD 38AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=z6sy3nCN; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jfOa4AiS; 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 b130si3291641wme.18.2020.11.17.09.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:29 -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=z6sy3nCN; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jfOa4AiS; 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=z6sy3nCNY3cbd3KXaQes5h4Av5 k3eIyxq+95WpQ+VNIL6yP/sd0SXHaLncNEZF4AkcY2nvhajoIGds0fRqEw4BkErY9doDMxUrkNywg Qu2E62i0jcyNdbeFGz7qen0JRMeck4y8Iy1ObuDz517TvvmP7BKB0dRBlL3OXr17ab0jv4DGBDnCu W9Am3+KO8Rimb1cPTKSYG/E1BWYhsorVaJ9u6wkJos3xmKrHk6nPsXpz6K+6FZsA3R9ZtUXrqrLN0 WKr+raMYu6YBlPl0sHKqzdLikLw0mRyhPdUngIF/aZSgim7Xncflrye/6lxb5A1e2NW392cGPGR23 d26lgzKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56V-0007DO-1T; Tue, 17 Nov 2020 17:49:19 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56L-00079F-Px for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:49:10 +0000 Received: by mail-pf1-x441.google.com with SMTP id g7so17781950pfc.2 for ; Tue, 17 Nov 2020 09:49:09 -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=jfOa4AiS/tPxjopccSsFwVuEPAIEFOQvgNIDZfxXpCqZM2rBRAbMSPUGrRZCUxk9RM M1lSMnYTKmkr2XwSjmUTy27z01sP+vWfmEPHgxDNEejk9lIudy+tadMlhWcbHgGXGsAR m9Hv77MP41Mel1ZJKkB6HvxyP0sB62RPYQoM944E6Eo6+T24PBAzzub48v8+buJCMMRL vwM2SOKLaPLTVb64Py+CQN2TERL4pdJLcKZ9w49oof+AXLuSDSzabeXmjYwy5mLyGPi9 ZyZVBHp4DECrukNla6p+KiGhOD3Jum1NWBvyRl7F4SiAeuW+7CxLg0w5K2zA2Rn7Xhls 0ySw== 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=Vwi/0L5LvKkwY/gx7YBZLzv5C54yIL3PEY3VkLFA/lvknKNkn6EchmLYGz1xxhHXsp i3kiezlYTfZLNr4d9LdAwHQy+jY1DjvYhxjyoHSPEjoyg1Hb9dWEckl4MhTzSSKD/075 3tmzKthSu5ZzE1OKGEW8hwaNKlPPwwCPBsmgXhYu5Wys+8lVr8LxxPYUiZz3YIWHyI2e TAUnGUy2U/fyMk4yIoOv3Plz1VZyCLT/lkM3JTDpzhgIiB8ctA0/8lMrhwLwsCLXyKsT CiN3aCp+9y4vPRMIn6tO+EOhw5DsChblKwIOub8QsnmSxOWHwrV9Y5X3gmHAsaC8GqLb XOsg== X-Gm-Message-State: AOAM533g9GrZs5Tks145EHB9LXOy9Mqm99ITdB7ncC8zRBoG6K5GRCXn P6W6x9VMT6ASsA7DRRQpKfvApIkm2Q8D X-Received: by 2002:a62:e40c:0:b029:18b:ad5:18a8 with SMTP id r12-20020a62e40c0000b029018b0ad518a8mr707392pfh.16.1605635347218; Tue, 17 Nov 2020 09:49:07 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 192sm22222810pfz.200.2020.11.17.09.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:06 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v2 3/4] mtd: rawnand: qcom: Add support for Qcom SMEM parser Date: Tue, 17 Nov 2020 23:18:44 +0530 Message-Id: <20201117174845.28684-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> References: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_124909_890621_CF8C931D X-CRM114-Status: GOOD ( 14.19 ) 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:441 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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 Tue Nov 17 17:48:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 325524 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4369602ils; Tue, 17 Nov 2020 09:49:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKMVavesJNumxpH9vREv9SzDLhw90W6mEq1ctsWTjhb6Gz9VgcHWysbU7Cc53aRuZylJ6s X-Received: by 2002:a1c:5f84:: with SMTP id t126mr247930wmb.172.1605635375239; Tue, 17 Nov 2020 09:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605635375; cv=none; d=google.com; s=arc-20160816; b=tv7a5vcgB9ZBA9N8FwMQ5tAA21ICkMPwSUG15WG737AG3UPY+/tGjjykjP+YgSZkHj kwkn5UMH2dafupZ/GZ03rOZkEQ4NJqiwicb58ORYaQLxO9cwhsdSoROZyNa8pEI+dyQM M3+OQFU+tCmJ85Y10FmuCRfdgmHS3MEFXVNhhcD6D3GX0OEJmq/yl6VsAcv7XAI72sU6 Z+UfWrt1E/4qZCmYXyhC54E1GII6/3cUmebupbcpmFw54bCKT9BsQKWUQq5Wy40+l5El hEZyDxQ4jUW7o3eGLK8TFJ84r1/CRwBj5ms3xhF2QyKtvU2ss+MpGslAbwRKgZUpqrHy PxdA== 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=O1VDfGgtEilHiPEXsZ9/7Hj9bvorPA+ooErhipMZexA=; b=VTZ3Qsc4ejLY5kl2QeKz2L+w2hzjsg+s9A5Kmc06q8+eiwoGScfpxFVgSFxuepskj4 deHsvk47WsZGcob4qFew95M6rczP5aOjX/YjH6AmbyaC++b50E1RUrHIsFXSDDVeXPBB KUfDhbHJ2IsMMVnJhr8g8A6ZdwHu1KVMbmiERBLaI4GJSkj0rb3AMFCD3oTA7nrY+oju VAlIJ/1+6dDOwzIgpCCifYd3DB5OkWO7bzBFV4mw8bXMkwfD6bHyqxCTOMjFJsxTu3Ke AW4T6I73S0GqfEcoqORlz2D1UOGJgKoWVQg5kvVz5+PYjLzlmRvc+bmvlH8mBkAjmUN3 r9gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b="McuaBG/N"; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GrQmJSal; 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 h16si20182828wrm.221.2020.11.17.09.49.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:35 -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="McuaBG/N"; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GrQmJSal; 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=O1VDfGgtEilHiPEXsZ9/7Hj9bvorPA+ooErhipMZexA=; b=McuaBG/NN9vBhgGye7ROQwKhS7 0bZCVdaeIeqR7jj4vfYBCbOas8zzE7hhvboIVThw/Q44tTcJhfe6LGiwcrcDk9UawDTv1XYCa1+Xe 3yTfFqLxbPErcBdWiLzs3lBw0oa8FGqgtZhhapl4ByzupWN1Ls1WozQrcxIwsIgQLlDJJ2+voSuZt 8RVT/iVWElXv0F9LFpJw+RN0x8BV6Ru6j5QyIXaAHQKQW+5KRKn5J3wVHA+LthYPzSXDnkaY7CYKl lpfyTAh3OMzkUjEaDRm9X7rzXqBqiv7Fl9NRMRlqIbGcU/rmw7CfUt0Kxh7J3OmWIMwKdGRAe/q+y 3Y6AdxKQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56b-0007FR-H1; Tue, 17 Nov 2020 17:49:25 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf56P-0007AR-G6 for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:49:14 +0000 Received: by mail-pg1-x541.google.com with SMTP id i13so16521943pgm.9 for ; Tue, 17 Nov 2020 09:49:12 -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=EAf9d4gGWEUWE1b+AMgq6WQ0FcZNv1uCLoEh96U6HDQ=; b=GrQmJSaliPTve3DL04A9GAepxzDBPQmaJDXflI0uIc24Ceqru5Te8SBteMXYibBiWV YXtyBkZcp4alV78euGq8ZrdXrY/s1xTOqwOzjdB/goMB33KUlG5kJWFx/V0Hqrk3JZEp zw7ndp6YX9rmihiKPQuebdAS2Wg2Jl1+n+zNJJHekxbJkjfpKusp/zA2T2t21GcxUBBV sZr+xgHWq6+/6X33ZHMmafEYZVgWboH6fcuIKZcdfC7uKZ/Gc2XP02Uwep7dMXIQHRUe AZFf9CI2yybVt/jWzI+IT2jw9m6POx/FLGVpicrbqCfBClD5HoQVjXuKaz0ESjdzURvc ZuuQ== 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=EAf9d4gGWEUWE1b+AMgq6WQ0FcZNv1uCLoEh96U6HDQ=; b=iMpzKneyHvPzq6ZdLrhlrHIIsC+RR2L8l9eJLwCmg1iY4u/dF514VfgrwkSJJEG2HO QhECu54nZ5PPfBhUsWFIXO3NiewhzOEE0DF/u45MFj2ZMo+lGuJKir6MHLliNKF6l70a pyDArRCuxml0tywUPQMk3fwBMXx7RN6fzYMfT5RUSBYdoOOhmubunNKxbgu/DuRhw7U1 B7JDOqHEbhF+/sr0X1pghCAuAr3E0hJ/3KcvKfqkx8NdS1GQejS8fQYIwFcfE1O8taHv nkMIM0qjvYtodDk26h0btRv/eY24/mFV4Vx0V9YxS/dO03wt9RIyfeevhhqufJ2gAo1l 7rpQ== X-Gm-Message-State: AOAM532zjyLduDFP7zBUItBK6QT8NxS1ElacmGaGhf9EiD2QDDGvSVtv eS7WmpjgbUsuvZqblETy67kspmPXh+7j X-Received: by 2002:a65:55ce:: with SMTP id k14mr4432790pgs.65.1605635350991; Tue, 17 Nov 2020 09:49:10 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 192sm22222810pfz.200.2020.11.17.09.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:10 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v2 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Tue, 17 Nov 2020 23:18:45 +0530 Message-Id: <20201117174845.28684-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> References: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_124913_583261_3D7FA8B0 X-CRM114-Status: GOOD ( 14.35 ) 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:541 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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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") 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;