From patchwork Mon Jan 4 04:11:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 356332 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp14658310jai; Sun, 3 Jan 2021 20:12:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv9MQOQrXbLSX1ITkVBX8w8qbemewJVtlrlSkwaHcFuQst+S5s1vLdf0DsFcIDvKdCDSHf X-Received: by 2002:a5e:c012:: with SMTP id u18mr58038271iol.15.1609733539328; Sun, 03 Jan 2021 20:12:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609733539; cv=none; d=google.com; s=arc-20160816; b=pWjRqFjPZ8obCjd4m4EaNYUK0vsDSSUhlsHeIaFc/qGi0n4o1W+lHin0jrVZ6lCi6u wSdIE9aKv0Ni0iFpUwjBZtP2BHO18J5kSGDZLEAF3GUs19kckFjMl/BoFKWm66L6dfAt 93x/EvTuzxFFcyBreCZDFnFKVpcNpVaG+zB2aruzGSsmwj8vjUZChjhjv2j2FlQ5J3Zu BozZ7swjMoBom5+PPTVWXiQrG6PrXHyLyUxfAHp/NRsufTfhDWtlo4zInx8tjb2hhoM5 mlYZmkO2Zwc4lzxj3YF3wHdmI040Z2CYFKM6YhwmqTUIWz9PLGS/sSfbEmDS6pAm7WRf ivnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=D2ekN6p27bMTRFmIXBotzRIfBhTXIsmRZKET0ExIzEM=; b=BgJymtifHc9NkNLa89r/9DtT/Bdv2TGUTj6/f1/1iyhZMOFxvg/+f14njI1by/Xisc QrrTNYdTF1m+0vnqyjq1f6QACK7erBqL2qcRHLB+N8KHrMXqt3Gaq02H1EZ2t6fschCY DG/44uHE9EUMoQDmZ+/n9QteyWgluWSYpbvIzDRRYdHYBuIT6fYu07Z1lJF0Dm6Xe2fJ mKBT0swLJPJfOScThgc1G7JnDLqqZrkHr/Ayns0POHyjNjSXbKAED/z7MHKEZizeamYV dIfpzpvS1WvsZCXFTD2fK36XO0xLpYJLufdtZrklnbXr6p/j96z9ig6Bp4KR6XIg7fd9 FZPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=Fb95fnGn; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ojLWO8Fy; 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 f14si39727506jat.57.2021.01.03.20.12.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:12:19 -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=Fb95fnGn; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ojLWO8Fy; 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=D2ekN6p27bMTRFmIXBotzRIfBhTXIsmRZKET0ExIzEM=; b=Fb95fnGnBF7GzO+xfuLvQL+oF AqOKe0Bn4rV1eXw4tLeCyiWo/4+yag7pK54CHBpHAL7WGxmZFUMg4teiS/gmM2uPeiIJ79B62EtWD JLC4xf7sq3kkVmlMrrd72gHIWEJSOMpAMOvVOU2oyqDBsxtU9nIQVzCbyWQk3EhLOW4OOp0rZZ2Dt 3rSu4igATJRkjqM75aUKwDtf68ougSKzbDK++efuh+/+6Ya8uCK4kI4qoiyWDSSpLOjGK9CH2DaiB zCNiunHN7XEf1F/4j9s+po00xwYv4YNswTibDp6d8U2BQYuMRDh2oPweek8LO8nHWx0MO6gy55nPE XA3rPYqsw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDq-0002O7-JT; Mon, 04 Jan 2021 04:11:58 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDk-0002Md-B2 for linux-mtd@lists.infradead.org; Mon, 04 Jan 2021 04:11:54 +0000 Received: by mail-pl1-x633.google.com with SMTP id x12so13812119plr.10 for ; Sun, 03 Jan 2021 20:11:51 -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 :mime-version:content-transfer-encoding; bh=PHjS6xkWESihBsNq4qcCg6QnCMAV/jOfgOFiTrhYkeg=; b=ojLWO8FyubFM7XkK10yDB4nf18PdsRA4j20KJpqb7sZyXWBg+Imh2CYq1b2xz2HiuT pReMw2wYur8JpJQYL4tJZqrUTASGmB6XC4V+I1s7MKoGrrbwGMgOSNtlgIWGj/yJJyUf NCVvFeHp0W6pdtplPyMByVXjznPFk7LAX6Y23L1M8ad+7XUk1dZyIcJOoyvLim0JPmM0 VS2CQ883Y7pKt0PiFN+ot1HpxB7FgzCrrTsgzMCQbxGBeJjLg/j2RiXaf/0MqaZBQq43 /xFPn4ZNQ/dPunceMZ8nJo8xYzagA694x+bmAv/HGxH044bWMSWOju1iJfhNlX5PKS1d e9tQ== 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:mime-version:content-transfer-encoding; bh=PHjS6xkWESihBsNq4qcCg6QnCMAV/jOfgOFiTrhYkeg=; b=kAxMHctOzyQcY6Rus3rxMK7aQAex8gpciWnCkvw33OA8OtLmTSXeCqA3P1Y4mD2Pmu 4Z8Ga/0QAexHhfJTYvH63SagNoPPRwZKv8C++f4qKIk56vPAYvSLCHdbIUjjh5htLc2P PpeiZxMWfll9u4qsu28fnA2ECFD1oFm+vWt61gWly2yxcXgxqv2/YHJDJyR5FO2wFRt8 HsMdl0Thv+DKQYT2JYerQG9wLTOj935hsQA6660Qb06pSOQKbVZYQy32sm/AsjLYBafU 5ZOdXLa4o70t8eU83fWZNIWn8Etwlb0Qee8i99lXo034zcHj8WNl79X9LOzco3iCBywB tinw== X-Gm-Message-State: AOAM532Ei7ri7kDzNhNjFlPxDqjDzLHfS6068i4DAbDhYh1Iw2VRP7y0 MaRLojZGDECYbE7vWCyT+7nm X-Received: by 2002:a17:902:9a44:b029:da:3d4f:abe1 with SMTP id x4-20020a1709029a44b02900da3d4fabe1mr70159622plv.16.1609733510263; Sun, 03 Jan 2021 20:11:50 -0800 (PST) Received: from localhost.localdomain ([103.77.37.160]) by smtp.gmail.com with ESMTPSA id x22sm54899930pfc.19.2021.01.03.20.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:11:49 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v4 1/4] dt-bindings: mtd: partitions: Add binding for Qcom SMEM parser Date: Mon, 4 Jan 2021 09:41:34 +0530 Message-Id: <20210104041137.113075-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> References: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210103_231152_520752_B5B10B41 X-CRM114-Status: GOOD ( 12.21 ) 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:633 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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, Rob Herring , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, Manivannan Sadhasivam 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 Reviewed-by: Rob Herring --- .../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.25.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 Mon Jan 4 04:11:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 356334 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp14658318jai; Sun, 3 Jan 2021 20:12:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrdaih2Hdfm6B4hpDoyITp7YDSXBB89b1brEiAmOyRGV/LKP4rK6swAhMGzYAuw0HDUCYk X-Received: by 2002:a92:b011:: with SMTP id x17mr68216841ilh.179.1609733540382; Sun, 03 Jan 2021 20:12:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609733540; cv=none; d=google.com; s=arc-20160816; b=if0GT9lyU5tk6wJx3EIFtjSYWQ5oy2R5omL3CATN5MqdeUl62upTU3+EjFx6JwIqqH gncl9atPIVGbluyiHs10NHBmHpbdFq1+ImNhGKleBPqKVMQWj7HMdxAtasweaqHr4eA7 D4BOCd6PjJ7QMZbNoPXZr1TRqx8GPez2LqtJdYF1KYIBaSLjHQ4z4xZPyRIb8DO1xzFC KInNB0R90hhT1lAGLzxVjbhqlvRJKthyTVGdga7hV4CfbXMBvMEa6YOfr3fGtH7iQVTQ JDMT3U7eksWzOrDn6fgZ1drKK2iKFDXJpMFoRa+OOzcfyGcsY4I6+5hMVNiUupriPC84 Sw9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=NSEsANBW4hyYGQ/SAx6Q4qlwyVeexMjCSRB83+LMuXI=; b=WtUsULDZuJCJjMpkEarx/Cc3CnwbWB46/jFpxeacmZQOMjtiSoPEqQ+QQWQVHQOtwp X1br1eYFy/OzcwgfwGS+OA63SDNtZWP2Te8LdRm89+4dI4BJ+4gKzwW8ENgX4rSuhqst meMfzwtCuAgp0zxKHnmOm07Amv0HJwn3sUPRAwvoX0k/Ua8eV/H7cn53H0ElUviodJwc YSHWMKNdg949+lK/7+Jukipi88MrlYZtCG0TVfZAiWFZ344I/MPNVtEN51KVR+g0vjok 6vymhMlaTBs+pof2Wmvy3hs9Yz9irrZWFPrdxBzDjlI7SusNU3am5MaNKUi2dFeetOaw yjWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=bqvrhc0C; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Pjq/zlDh"; 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 a2si66913714iow.65.2021.01.03.20.12.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:12: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=bqvrhc0C; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Pjq/zlDh"; 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=NSEsANBW4hyYGQ/SAx6Q4qlwyVeexMjCSRB83+LMuXI=; b=bqvrhc0CxQzfRzl5UScxDl+rm HDFFBb2KkqrQD7PLZkYQIE01QoHL9UHTMXIz0plDYW1UgTZSd356v4JWZVDYzA+km3jcD/ljx67Ly U5AbIYx5rTvUibebjOw7EUhi/QEu8Iptma+T7q8P7mYUyt6MN6BgEzuRmGJa+HWMYWvVBASSKrJR0 /CMUeu5it4PpU1e18zBNAPJQDu1m0v77QYCRNr6XP5kXvZRg5EpCE/IChOA8bs2SbY3l5DIVvg2Hd ufwTj1MojIr3nDo9J2oIn0gNR2Koc976epSSK4bj7NVuySKiBiZw/ItXo7+Q1bO9WaOJiIvxbOq9U tfxYr4rAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDr-0002Od-UQ; Mon, 04 Jan 2021 04:11:59 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDo-0002NS-Nm for linux-mtd@lists.infradead.org; Mon, 04 Jan 2021 04:11:57 +0000 Received: by mail-pl1-x629.google.com with SMTP id b8so13841108plx.0 for ; Sun, 03 Jan 2021 20:11:56 -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 :mime-version:content-transfer-encoding; bh=LtzJNG/ybBQAKeE9SVe1i2pD24AqKDwuHMdBBu5YoUw=; b=Pjq/zlDhQU52ec2VtPWznvDEY3x/Pg2EJpOnTPWJua91GPipl2FzaaAqLy6u4hELFm u3UilYsYaE1X/pf7JeiG+w0khUQmi0u08V2KFJNOxyCpgyuSmSJ+0MTQKdpAGdE55f7T ccHf3NlUWEvU+U0/rNkZxiry2Uf9QkqtPhUATjnFWWgX/POHQR/E1PUTSzy+WkgHhXaF atQkAqo3PTWqyjFQJv/ILMRNvtsqc8K+i3Jd298LHDetTeWogt1VJRX3oN5L7LpblFG7 AJ8mZ4niSwfGaYGiQg2XgopKGxNDeev5bdhfNlotl0tAoZXCrGZa8otC+MAGN3wTUw0g R7dA== 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:mime-version:content-transfer-encoding; bh=LtzJNG/ybBQAKeE9SVe1i2pD24AqKDwuHMdBBu5YoUw=; b=fLMYoZi8XlUZDR97hU2iVrLf11qUZm1PsSxNi1ZsDxQkOZO1KTtgVisjNmY72kQgtQ gyNAOrB/S+A5vbyD2j8WnoWXhYkW4clC9I9OI54zLr/CLGA0Fvw1bCbKNitjVV4rIa+P WlTcAuMRS+gSAl/NhvfGHLfV1Mkeh42eE/38kTJipFL/SvHFFtlvsj+XtFH7uX2yiXAf IAZ/wVjnSGwicEipPcKIfNmEPIoPIofZ9lXI/Gik6CSpuCCUJyEEfZUsm/J28+dERgfU lLbg5WE2R4eNy/S/IOLGHERFZtCjhYw9NlfJESaI1JbA/T5kjMM4NeuHnmydUdM+Jdf5 Avxg== X-Gm-Message-State: AOAM530AVZol3K3sastoqGcKGYDSGnHilMtP9UUJEVpWaYPWq4Ws8131 Vyqh4XTKIWVtPdJpugxpq+ph X-Received: by 2002:a17:90a:2e82:: with SMTP id r2mr27192058pjd.46.1609733514616; Sun, 03 Jan 2021 20:11:54 -0800 (PST) Received: from localhost.localdomain ([103.77.37.160]) by smtp.gmail.com with ESMTPSA id x22sm54899930pfc.19.2021.01.03.20.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:11:54 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v4 2/4] mtd: parsers: Add Qcom SMEM parser Date: Mon, 4 Jan 2021 09:41:35 +0530 Message-Id: <20210104041137.113075-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> References: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210103_231156_829675_AD8A27A0 X-CRM114-Status: GOOD ( 23.89 ) 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:629 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 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.25.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 Mon Jan 4 04:11:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 356333 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp14658311jai; Sun, 3 Jan 2021 20:12:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBCUmbQFB5S8s7+C00KEXIHIt1N4poI8u7R6luizOnD/Nk8s9p5NnV7R9NlrMi3F09Kxxg X-Received: by 2002:a5e:8e0d:: with SMTP id a13mr58163149ion.1.1609733539331; Sun, 03 Jan 2021 20:12:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609733539; cv=none; d=google.com; s=arc-20160816; b=ZJd1BYEl2T+FWuFr7i3avYnoV5bHU5ENdXiF3Du6Ij/JENWnf71usAGwNw1oGr+z1X OZAH4fVWcmJMfj33gwAhPzImnjghd95ABx3PmsQiG5L9rlTuoMd/OgqaCMag0tWNYoFH fMPyTLWZFTdSlfS0tW7WZsDIMtX7ACREsLQFr3AZUNl7zIOv+xnB8FsbFRnTqXAA1toQ QjcG1ehPWYc9mhn2sqUG63+5FF1CkMcwunZ1gGgcQF4iQIp/XPZYheFfhZP4eLn1bORq yYEtendJA2rOpQFm9nHpfvK7MDBjkFydh1ZeN5T3gZXHKnsPWW0DREbbxg+JrjfyXPNA 2mCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=dXJKdk6Kxmp3uNTKJL8XYXuNyRXj37NgfFKM0Kudywk=; b=ochGr5/EjT0nf3hsv6DY4VUmTUt85xx4QCVIj16b8pClx4DzFSleBIQg9XXiHebkJX b0g85zmZ82GWIJZnbPqqbWRmCPE+90DJZusw5dRqd2xrdeO0Sf6N/FFZ0qpZF9pv98Th 6BCOeBu2c08xID/uOn91y8iDZV2EmeJdWWDMRuM9JVaoc2J9ooAy2AFgYjzHx6KgVtUQ SXBNAlwLDHdMxFV/8YgyK6q88ORXVjO6m0lbUeV7sQIPUUSJLcam9JoTQDJpCafxlYsi e+6BWnknJ6ZLZuur+lDB+DNShW2JcW0p/KDFkZHtjeIpfalRSa4AUZBTdnpvLbVDfiO1 8zfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=HN0WLMlB; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MUCjeC0n; 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 n27si62036707iow.82.2021.01.03.20.12.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:12:19 -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=HN0WLMlB; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MUCjeC0n; 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=dXJKdk6Kxmp3uNTKJL8XYXuNyRXj37NgfFKM0Kudywk=; b=HN0WLMlBh3NYPh06i33W9VomX 2AXlTS48576YYXf0hIOC0op9oHFc8DJdAQJ8oLtbnfumrJlGWEtPPRSLbFCabwCfzj2ACp46k7Fhv i5ccHi9ePwFIMs1Q6mS7rRRldA9oduOATUvJO1vcj7iJDoHnmTSKtWtiU7teMwc+wzl6jq+ZNay2I HcOVjPYxf+LHT5+Md3PNVTlLgjkSUwLDbYFyglNHR81/iQKdbn4veshzlmVqiiAos48gl5Az80sO5 RSgM/jShAGTLhVmbvKJelJh1KIb+RzDodR8o9oUfEIAp7SRUo4QbrEirmHm/vyLit+Yz7xdzT8e2g 2b+PGkpiQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDv-0002PW-3p; Mon, 04 Jan 2021 04:12:03 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDs-0002OZ-VI for linux-mtd@lists.infradead.org; Mon, 04 Jan 2021 04:12:01 +0000 Received: by mail-pj1-x102d.google.com with SMTP id lb18so9219068pjb.5 for ; Sun, 03 Jan 2021 20:12:00 -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 :mime-version:content-transfer-encoding; bh=icXjVyLr8ROGK9HCrfmW24KYFfrqOe76+5Eys2pUaYc=; b=MUCjeC0n9Jzu3Ybx2+wYVVQZHu+be4Ab/JPXX+mx10mppyE8coiYJHLOQtIFIiWFDu tBlRN12//WUM+lgkJ6PgC9GzcdK4GHlrAIP6kx+aY7vfmCUtpostUbWZCfZpQ12UkCNd YILCpHW+eidapdhkVCU2wnGb7ghd0CWy99a5KDahC2HjtHvatBy24V9XvqkEw13tpddq pYhhyexGjqX5E197g6JPx9sSYsm66uBLzbGojSD10uk6mLqL8umyT4wb09EKzPZPCZiq UxNrEFHQLeF5GjsYB/5icUIISqQFUxKDglWMdt8qNdZ5GPbR3ipp8tlvgXKgx4Jpab5X NTlw== 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:mime-version:content-transfer-encoding; bh=icXjVyLr8ROGK9HCrfmW24KYFfrqOe76+5Eys2pUaYc=; b=gKDgL6c5quXAZebR+GSR9yTkQtTUQS0wAoPrLNU294Yq5eLZtzpgS2TVbEpYcXWPAd faAcetjiHdxyKWGh9m8u4VoBGKE70doygCyte1ivC2ppIEeFSBmTHZTyNXdd45MJCr9F Cx3wtab50TxGnV+5iepzwhGoUlKvZHYIiWxjxw61jI1waLaElVfcdawZ2Zr0mMaewwaK uS8UmF6cvhlKUEjkWgl1bGogdyZUH2TdmGaXdJgx9EFC3ZKRdLPoNhxvqdXxw40Akmsr O6jOs+Qp/xSe24MgdJBq+LAhhE1vSlthGcKxo+OeGBy9ntxdo5j4BqP17yf93Sd6d/Tr kc4Q== X-Gm-Message-State: AOAM530Z86XOHGQhurkoUFpAH/lZnmcphj9yKTaTKV+sjbwSw5VHNcZm p1R7n22pIFTOkpYUyT1sCqEe X-Received: by 2002:a17:902:6bca:b029:dc:34e1:26b1 with SMTP id m10-20020a1709026bcab02900dc34e126b1mr52162525plt.52.1609733518888; Sun, 03 Jan 2021 20:11:58 -0800 (PST) Received: from localhost.localdomain ([103.77.37.160]) by smtp.gmail.com with ESMTPSA id x22sm54899930pfc.19.2021.01.03.20.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:11:58 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v4 3/4] mtd: rawnand: qcom: Add support for Qcom SMEM parser Date: Mon, 4 Jan 2021 09:41:36 +0530 Message-Id: <20210104041137.113075-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> References: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210103_231201_046973_50C32FA4 X-CRM114-Status: GOOD ( 11.97 ) 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:102d 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 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.25.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 667e4bfe369f..fd4c318b520f 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -2821,6 +2821,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) @@ -2884,7 +2886,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 Mon Jan 4 04:11:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 356331 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp14658307jai; Sun, 3 Jan 2021 20:12:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoyFwtOeSeZB4EaDNtuGq1NNIjDWHI7uBCbC1x+GJO0qT6fkKUI5uprA78PNSO0OebAlyz X-Received: by 2002:a02:2ace:: with SMTP id w197mr60541923jaw.132.1609733538740; Sun, 03 Jan 2021 20:12:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609733538; cv=none; d=google.com; s=arc-20160816; b=gBO1NNLrZV3SSeHAsVYAHnIfzVrJX9AS0knhsK/xnDeRjBVy2XG3685iKGV5ERos8V wUaL/eOjXRA7j1FN700WpMHSsu7WScXDn0oJ+mC8d7ffiI4D42iqPHGt05CZVxd0xU1y y8oOua9ZZtEmh6TNFeDPz/xres84KMbAed3c9zcN0IbmR2b/23Od2jJ9TJcL1B8LIsyr Qat9KFBqjxcJ1kzn0N8cHcYSIZow3eoqLxZ2fAuMxJkZyTiiq5p6cqEjb9LvzMHH9w2N PCH5VIIKfUP1916QFtD6Cy77DLIDND3Fg3+s9qagL0yd8/1SFfwNi3yZjK1h2OnZxiw0 Zlvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=v1SavrlOVRrF9Yl/3+44To7cZlMjrpdrp4UyO2SRF7M=; b=Vbzj3JDipTPnzQGrjO8kHa+rWxMOB1sTye66BPvJFClfxEKNZYn5RP27A77LCbSiis HCR4cnuCWdV9mk6ecOHWR30LEbaJxltWgJN9fXn1XZZRtMZ0CoaaNl1gdVPjbT0DLdd3 7ktZ9W6utJBYUy6VyJ4sxT9Oc9siNzcal5fcziMca4RNADjKC6eE4/LKhNofwIBOqBjc lnAK93lW9lBl995IiOjL2o5veFwfzrMzNYvcGFkVTdE+kNaE1YjicsrNk8PSGiqYJrrF fucd9mAS8hykMD6tlVCo6EY1PH/11l2T0Xl1HjKB0MgaqtYZuLFhPisOqW5PIlWPNt0A xcIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=pewlChqJ; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kUog3bVT; 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 m10si39296541jaj.63.2021.01.03.20.12.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:12:18 -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=pewlChqJ; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kUog3bVT; 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=v1SavrlOVRrF9Yl/3+44To7cZlMjrpdrp4UyO2SRF7M=; b=pewlChqJxcuShIQOvyD70uv37 RupOKiHyx23XWn0CQxpY0PcqZ2fHc4IXeRt0rvOkEbahJBk7EQU6RV5I3SgzxOL2pEUUsNqqB3mNf Ltq4wFiVRXrx3ZLyMn3glj0o7HwgWHQ6tShORISXC//zcFwzV5fGxOH3tRU6raXqM33Ru4jlvCW2m iO9QCWoI0e2VAEIQZICck75682RdOaEEheX2hi1SDgeqhA9XvjKbdfcrtqAW59U84/kTEub1zhmzJ 0R8Z7jQa0BBjrvlJ6CEcErhCaNsk4Vs1w2iRNktSNNHuhSEdsjny6AQ9JJlRKHtRzFvc4lM0fpwDa WJctVpC5Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHE1-0002Qs-I2; Mon, 04 Jan 2021 04:12:09 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwHDy-0002Pk-H3 for linux-mtd@lists.infradead.org; Mon, 04 Jan 2021 04:12:07 +0000 Received: by mail-pl1-x636.google.com with SMTP id q4so13818767plr.7 for ; Sun, 03 Jan 2021 20:12: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 :mime-version:content-transfer-encoding; bh=wneBaSsM0xu86yHRW+fmULQ20sTukJwsm41Qy3J+Umg=; b=kUog3bVTIvYUWWUzjYQiRQyzxAlie5iBaP/m/YoCMjhOoCsT5F3U3JzXz4OfLihcw1 1Jfz8lCNkbUcL5zpmLYT36af6+u9c30idejRXIJnXxpoWV1itGu7GtGC+EeNuWsl9txK vsWQKMoxfakSo0jp85msmiCUaKTYvpvbXOcCcnjofk2XnHJxOk6ncEMs+sVEt3LhN4Ck SnN2gH1CzJhgK7MG4/RjaLccO4G+1/BNgtpUW7IeHVEYx1EIGFM8BeL+Hs2HSngLT2Ng si/ivAd11a85yLlElbr6ZR4yQSLZ8SrYFtGdOjBTClmTc4GfgJt7S2xED02PsfxuT/SR tkWw== 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:mime-version:content-transfer-encoding; bh=wneBaSsM0xu86yHRW+fmULQ20sTukJwsm41Qy3J+Umg=; b=IN+mc4cofl/rmkS6noaxxkuUeUu7Ruc5WAj5dbtqnz7VY32jY5Xs1MP2nBWc1xDgyJ tqNxWohaXsTJIShhCrm8RO8fbr0F1o/02INc4gYMHplkavGQlttpB9KHhD+neWDe4ryK klo7/IY3w3I5oHpyzm63y/9GxiZnu3FgOSOaokrE/gNa7m19uurh4Y/f5xNvCFjtZVYB jlUCv0QlVeB4WWmaF1NH7zwCZMO+c6aYswK5jXG+jhoIgqhePNMWvwudo7bYlPj1IFDI y66g6hB/mB4A4elWbPCagu3TOAmx16v3XzrGJv27n22L6mVKyzHVGrg0M6AQcIS0bls2 R2FQ== X-Gm-Message-State: AOAM531XHr2oTUXuRsd0V3HHtQ3lbKABoEoD859bzMmauRDnt1UcFLYz e8Wsp7D7v7DcfSd01Cl8pdSP X-Received: by 2002:a17:902:8d97:b029:dc:313:ee70 with SMTP id v23-20020a1709028d97b02900dc0313ee70mr70807129plo.82.1609733523386; Sun, 03 Jan 2021 20:12:03 -0800 (PST) Received: from localhost.localdomain ([103.77.37.160]) by smtp.gmail.com with ESMTPSA id x22sm54899930pfc.19.2021.01.03.20.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 20:12:02 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH v4 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Mon, 4 Jan 2021 09:41:37 +0530 Message-Id: <20210104041137.113075-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> References: <20210104041137.113075-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210103_231206_613354_5B04EBDA X-CRM114-Status: GOOD ( 12.78 ) 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:636 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 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. Fixes: 1fca1f6abb38 ("mtd: afs: simplify partition parsing") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Linus Walleij Cc: Linus Walleij --- drivers/mtd/parsers/afs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.25.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;