From patchwork Tue Nov 17 17:39: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: 325516 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4362955ils; Tue, 17 Nov 2020 09:39:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxe4qrHV1VWF0J6o+iadn32mavhCWCZMk3Mf+Zz1maZk9J1w2ekKlnEv0K+MMbToIe3GXWN X-Received: by 2002:ad4:470d:: with SMTP id k13mr714433qvz.40.1605634789289; Tue, 17 Nov 2020 09:39:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605634789; cv=none; d=google.com; s=arc-20160816; b=b5v9gePvqXoGdurOgpAN2q+60bGBvicxe0UdSQZVLVbS++wegiAsNmr6lRE5MmmaZd LVh6MttdEbm93rkt/3YfFw7urzzlYFengGYZPeJXvuCh1ynDuTyYVp/feots70t94lpZ 8C/EN5Edln9w+5+AFPwbTmf/vCEFd/xb7UmVtrcL+3tNT+09iCdAxEkWK7dOCpnptaCs VxYWBtFvRznc5CEScwTBNXxlkbCZphD5kGyRQJf+eNtwvvZyAj0sqEjKXsL4IOOnxeKh MTkuM0tpZdxCajuh1H3de5pe+sEy+xW2BdA6Jsistj5b/pr+biubb5kPgO4hnq/w1A0l AKAQ== 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=tmMFh1kV7OKbsb0MCbTeNJ/zwh7BUZDMOozqoLYmcK4=; b=dOKanVlnTV5vvRgGLDs6KN1ab0VwFlmXyTcYM8k6e1NyAkVOkIgz/SwmK/t9PbtOxz +e/B/5VNT5DNhjRIope7g646ETdfrjtQmsBAePURLSey+vjyBAD+pJwCzmxrPEw2zllh NTn+0L9OSfyjBRrQ0cNfOkHmtT5moD3bzoclFI7WjAB947NpMpybi/DoD71kTfa0Bm2Z SFvhe4g1UWpzXPC5+PBFp91YrychA7vUKY6yyWIAQssKyVP3+gFnh93OEGKNEGITIF6U w19SMnIfesr7SL3RB2bNYQPn4ixaejSLuC3GfmGShfTwULmVPgSy3S+G+kCQpTquIRqb z8TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=C2ufzJ0j; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iMhheqEE; 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 v23si8987472qkf.375.2020.11.17.09.39.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:49 -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=C2ufzJ0j; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iMhheqEE; 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=tmMFh1kV7OKbsb0MCbTeNJ/zwh7BUZDMOozqoLYmcK4=; b=C2ufzJ0jnvqQcx3+xFIIdIYFSS UD2sGuJGUMFU3UnKEl1sB00M1rVw+C5ZlBese7lqbePaXHG35jlIspdwI9Wh80EQcZAqUDqTOUCze jN2hlaUv699+5gO2Jt6EHRlz9v8TlYdnm7WZMBxCr1A4Fg72i7M96iK/u7aZVB5GcVXSUp19YUyKx 4ghgD3nAaYn899aDq1k3B8cT9CAgvZC2yeN2V18DfxgVxTYBnyt3aIe4aAsPiRpjoB2eib57NX6cs Z0j32ovMo7VCapCgXRI+BwvkUcjB+ldz0WXKIu8BS4zokWHS+act2U0B/mCN/abOdZ08npp/Ibmi+ sZpiMq8A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4x9-0004wJ-RF; Tue, 17 Nov 2020 17:39:39 +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 1kf4x6-0004uj-Or for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:39:38 +0000 Received: by mail-pg1-x543.google.com with SMTP id w4so16473195pgg.13 for ; Tue, 17 Nov 2020 09:39:36 -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=Z7z9ZRILC9uN9iHlx1xbJ9BYeKh/BzimXNJ9muC2tZE=; b=iMhheqEEtzlcTH3JWm7eKlSWO6dx+/gAWszscdzjMx9IT9JSPVzPdUu7Xlocg3dVp4 RS5+e1e1hjcLCK4A+Xpo4IIlMmbkHzIIbD2VtAQsYELArr5qAx+uagVGYh1eFhhw1IeX mHCxvRlro8+iZzHxTuB5nBNU9tQ3IigTM/1s0rYId0eGZI3F8iOZRRHbpqUW1jtrZpmx JjLzFAODDzSPZMWTuznEM3H8wb1zgbLgEqQPXiR6p5/xCR8fdLQYDI9JgtN6T/0q+0tI 1IKamxmeuoflCVM4GPjY7GWDfebj3peqcn6JdlCYn1E2pW8mSoz6M6WDcQsI1WCDXFrX uqNw== 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=Z7z9ZRILC9uN9iHlx1xbJ9BYeKh/BzimXNJ9muC2tZE=; b=T1+7AaQUBD33VPokZHDm+3usT2VunKdsKzdeqN1eU77tw2eockIRDckGtwYSuP98Ph /7E7ROHlWBUcKcnTCvpjO/6pcR8IW7EDvOTIodiWWYlXPop33NUZ7s1f/+pkK2atPvNg mNzch/uW2+9nha94eZKdCPt6DiCxMqG0tMJkbZ5fsgadrDeMszEgu3s6mYggPXXGmZGr O+RzSq4s4A5DfeGDvf3SQLYWNFVTlf0ZRkCYub2jXjq4uQd+g8fw8ip/8jENSJ/4Bzji C4Z2CHRCNDJF8NzfvHzOs+bj1KSa4uUGlQx4mKPJybbNrHJpZvB924m1M3GBkSEQOUuZ tnCQ== X-Gm-Message-State: AOAM531x/CzxyFbKpdWe2DpUm8jRV4ladyiIBE+nuY3bsKaWe3UEIuxo wmFwTjci1Kg1UN9S7uM4U1Eu X-Received: by 2002:aa7:86c9:0:b029:18b:b0c:53e5 with SMTP id h9-20020aa786c90000b029018b0b0c53e5mr381547pfo.57.1605634774347; Tue, 17 Nov 2020 09:39:34 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id a21sm1751330pjq.37.2020.11.17.09.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:33 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH 1/4] dt-bindings: mtd: partitions: Add binding for Qcom SMEM parser Date: Tue, 17 Nov 2020 23:09:06 +0530 Message-Id: <20201117173909.23585-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> References: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_123936_882926_B4F30423 X-CRM114-Status: GOOD ( 14.57 ) 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_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 | 31 +++++++++++++++++++ 1 file changed, 31 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..0682aef2d54f --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml @@ -0,0 +1,31 @@ +# 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 + +examples: + - | + flash@0 { + partitions { + compatible = "qcom,smem-part"; + }; + }; From patchwork Tue Nov 17 17:39: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: 325517 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4362997ils; Tue, 17 Nov 2020 09:39:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNwkE/G5TwPfb3HxpVZnfkWlXZioio72sheicM6fBJPeygIwaNjYA5gGedZvshJrE0Coub X-Received: by 2002:a05:620a:123b:: with SMTP id v27mr633055qkj.463.1605634791858; Tue, 17 Nov 2020 09:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605634791; cv=none; d=google.com; s=arc-20160816; b=V15U8Tg+S7JH5PaOycFjIMdYjxEFIRKv7VRImHedsyDencpNGaVTCpd/WOrPIrESh3 pyCNmKUQSw6ObdwkXqeBYjI2Xon4FFcgbM9eWLrAsREvc3TgQFxpnOaq/QhlAjKMevXF Ut5Ij6qTYUTyI43NsvpbwgW0CNwosahy9WOXwF5eFf1OfcYgrvYSr1bHYuhasjCJO81h lLCsaxMZOVfLd4IuZNVldlZFdalmAr9Gfl0omzcfEN65O+2T0vKU3Lill9SiG3Tn6MK6 a3qSyszz2SqRIJe+8XwxMKgofyilwGnAkhlN9taNZhJb2nJfgaX39/cAmihP/FLDSUiW HSAw== 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=w2q4ZBMdcSUogvLeZemaFxQCrC6IUhgoSgw2XXTHqEeHGuzo8T3s4ObdyMRJE/p4rL 6isANVeJYC+oLeqO3cM7xNRRAVpJgclg3R20rpMkOAgO9DpXRqlSbMnWgBEYq6Ixkni/ 9kmlwHKL+EW6dRlF8UBhCF6fR7RR3pIQvF2z6SkAmy/pWBPG7WRLcSrmGpg52sQ/ckKK OqEgaOmTjQwIdWxxMGs8TC5qvzHF9DiRY7Rvws22HCLKv6et3r0KuO9ajR1d/11oCezg 4pbSDG+cP5XU1vJ8mBUa123cP1oJi9a9sV0e0qpsjunVHCVgxSb6r2TElWnRXtCriNVB KXlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=krOqVCV8; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eX71zyKq; 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 71si11784106qta.159.2020.11.17.09.39.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:51 -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=krOqVCV8; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eX71zyKq; 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=krOqVCV8/E0IPT7AEY6mEcD6z9 sExvUfWnc69xsDxbwTDpFptZ5wDhBgh9xUrpgB1VEMzoW8JN5JBNBzmFPoJDcCGy77hdVZlZadV9c P2+dXSR51JWYyqAYAA1ga6WO8EM4mlScnQlMR0C6EbGBujKwHyyFhvXUkebnWckiO0j8Mn+Ivl+1z NAVZfJtk7CHpyD2+ffj4Yo/ttkB1Uz2Bc9RxvyfYsTgqA7eOJ2ph7ZDV/JiigixKy2v+2AVoOfGUg sl3r4djiO/hcW4mY6vkodZ0GYUtR7CRRegAvc5DJ3W0fUGwwZU/o7CokOdfoN/nRUafTZWZDPuMMC VwXii7iQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xC-0004xD-Ub; Tue, 17 Nov 2020 17:39:43 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xA-0004w3-DA for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:39:42 +0000 Received: by mail-pl1-x644.google.com with SMTP id k7so10632782plk.3 for ; Tue, 17 Nov 2020 09:39: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=XZq3LdMiBAVThwX/6HfimVVHNbrtDf6lTNLc0V2ON3o=; b=eX71zyKqkKwRTekLKKlatG/zA0h7n0Lz4f66OxWEE4W+EqO36iIMrAzOResdDszeJ5 0S27iAsbzwo5sO5MIA/FyvS8tMZvG3ASfzQvglFNrP9s7CBOXdxe6CDUVEoHxe606AKb 1M9+1lpHrvf5UIWdeghVNIxmST3gbwMBClRSp5AiqsmFj/vC/bemZdfmOyamcGV0Vcfo xnW/VAkXtuSfl6i1y2OfhLG6WCuNqBA9yVmNrrjlBPaZvl5nxTZddG+mki4ZTd/UqY0g jR2JsGR1scVkFsdn8T3FzIWHOC6xCkpfRc9QUyM98D402mzfuJX9onyRjt7VpkgqRymV gFfA== 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=fNGHgcX0C4ZxpzBGyI4qjdkn49sPev8Qu2zqdM5PTMWdClquonyPHhFYlscjBu+lva azS7HTFk+3YCbnOQnFK7EPMOahQQTrH3udQAyyoI4rLz3crcyY3f6kzyfPNY61MZYaSq hap/t5bmSLEOvQLvk5nfbcDKcxA0Jz5NWx+8Rs1zrKINPdDk8iFlNgVw69xlqQfpurjO w9sSL9ICsPMrwivV6gCdrU/BJwY+8xqgdyW/egs4Q6UwaKT1wGlWuo+2/+n2xc6fGqVs L3uEHGMYnqOm68C9+9LC0FhrgU8M/VD3ipD5N6z0WcSwBPFlEGXEtSi14ccjVhfx15cV CfOQ== X-Gm-Message-State: AOAM531Aw4E6KReX7LO9LtDeyDAnq4bnuIazZZdBEamZNCCKQ5nA8hL9 B+rkpXcVkAdPM84MZOnPIVF9 X-Received: by 2002:a17:902:aa8a:b029:d3:c9dd:77d1 with SMTP id d10-20020a170902aa8ab02900d3c9dd77d1mr271360plr.0.1605634777936; Tue, 17 Nov 2020 09:39:37 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id a21sm1751330pjq.37.2020.11.17.09.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:37 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH 2/4] mtd: parsers: Add Qcom SMEM parser Date: Tue, 17 Nov 2020 23:09:07 +0530 Message-Id: <20201117173909.23585-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> References: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_123940_555254_FFECF16F X-CRM114-Status: GOOD ( 25.96 ) 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:644 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:39: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: 325518 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4363078ils; Tue, 17 Nov 2020 09:39:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/FD+0N97ju2nE5dhLdGAgnTT0pn4LMfrkSy7vpaVBZ1YYuljK24tQ/uNGZUGX5/XlOaz9 X-Received: by 2002:a37:7345:: with SMTP id o66mr731286qkc.222.1605634797228; Tue, 17 Nov 2020 09:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605634797; cv=none; d=google.com; s=arc-20160816; b=PvREOquMT8jc+xZqMpcusdEG8WZ28zJMtC0SoNvnEW+h8Fs5lrZqTGXNRPReHgktej wwKxjA5XNFgErNU9wZLl8Lhon1WWg+WX4xWG18RR4UG1Z3mvHFAJorzL6FHz8QiAOIsY wacJxiz5TeEZnb7qbL4lhnQnG7Co+OqtKkeaHcdxT2QeQLsvgstnHcA+MMPDROHstXRJ +sRZURgk1NuPp21CxaGJEfDnSxmsi3w1FvNXsHfYEGepTZfJqE94WapBcCo5s9SM1rVF rYa2FKYXc0MnWyY2d5oFxZzNpUJW2Egd7QJU7v/SB+f0Ob3TmryNh1Ubq5ybCPTO+xAT 73Bw== 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=dAJI3fvBrL5BDtcKJijcQuIn5Cqt0irfPRhDGzVKoZQR3KNzcmce/msT8Db+daaR6L 3xDGrNclNU2omc/M58njJeKlwiHUnti3/qhenBABFR+F78E+YxBqdYZgvM+MOr4FnU1E 0TxfG7quLy1o7Sh4D2mLUPFn+OTa8gHbgS/4tC0Jm0vl8yZCgivy16OCVJIWm2UThadx cGiDnHevV/5zsmMPavVhBWup2PrZ/KbNHZd3P+XKRVJFCnovzdnj+ZJ+VQ5Vm/2RMrN2 /tn5Sj/f0guGlrvewV7pHDkXD31nKL5bp3iIL99PLSN170yfoTCPMG1qyqQ2FyEhYiDp FOxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=3NtotmS8; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="r2l/3gDm"; 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 j6si8229460qtr.115.2020.11.17.09.39.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:57 -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=3NtotmS8; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="r2l/3gDm"; 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=3NtotmS8hzcpMvnfaqFTiNnaXo f3T9YXtv4/W8e7HYw6a88Rr9zAzbnktcpLx1plhUxyvuHQhAcDV4fHtQGjCFvMHXl7xzFAxA254qi 1rfmJ2IZdajdwmnP+5pk8VhrVQTQDmz2hBEb7+/Il3If7sOiUPCYHx6z+BSs+hxQoQ3NmSaV/zXIi EsDa1BYo/6lDFR5ytG5fkS4tWhowbQqrM1S5xneEalo7ew2hLK8qQqUULEhhfMIkKH0rNQ7hlYiFI ICIwnVSMEWkEr/XYMNxSdiazmHGHMhlLHFRlHk8aWLrDtb9JGQRVRaYTBD6CQ5Bp+UcZHkVk+m0qx tz2TX2dg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xI-0004zh-Qc; Tue, 17 Nov 2020 17:39:48 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xD-0004x7-EF for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:39:44 +0000 Received: by mail-pl1-x644.google.com with SMTP id t18so10632173plo.0 for ; Tue, 17 Nov 2020 09:39:43 -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=r2l/3gDmAVgeNBGWi099+PAX/sTSeFVw6c+bxA2Hxkv4fjT5HS9mpa2z7tazOtK9x3 jDkxryWC58TOfLH4ocEeaFgAfHPtAIFdcvcfe1duzLHaTyC3uHatHSyu3Eqp9RVn+f8o NUFXuaelDV5NiF9kKij/jaDrloV5V2WiuFbAQ8F8Zqj+CETA2T5S0KecXLdjtBLls4XX +Rp5iovP8vGlci+NNz2Uhbp7NbFb19y/F+kt/KP0U+pl+JEaXUA8ApWLHow0W7gnkwnX +vHpA+9vRpzvfyfrxKFJpTzVtQSOaCRKba/fCYg+iBMNyrUNmj5n1FjGYzWSNbVR0EJz t3iw== 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=bYAqU6ARAVz3OKtIRvVyjWcw2fyD+v3aoXJjntssU0+LoDz0Jdygy62ydLpHCp0Fgu /ZYvPBPuvyCoymiZ0FY2CtHreLFmS9+cdaFKgd4vv6Cb6yl6Kyvba05IkKzio7NT6iL6 NX5tR6ygbhgi7RezPyoDrXyUP6QKYlNjywnOPwQzy8GKAOTfDkkl4Td3OrNMLhtKK4/h EylPZfNPaSK2kwW9ACD4+tarKFjOo7vyr6f/MpRnT68xKZCrxZhuTarMJAvV8lGczda1 AU7Q3e+kgPQ2lxlDEtQrgpH19rZIIBH3aoMt4zSv3xxFfKZ698rHUSen8R2Nh8hrzw3Y 7CiQ== X-Gm-Message-State: AOAM531tP4A7s/cDl/sy8BLpfg+jvVi34ESYRHmsgtMYkOBikrxebbsa xk3rUPsfB72WXDW0yAPaqHGK X-Received: by 2002:a17:90a:7647:: with SMTP id s7mr169690pjl.23.1605634781695; Tue, 17 Nov 2020 09:39:41 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id a21sm1751330pjq.37.2020.11.17.09.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:40 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH 3/4] mtd: rawnand: qcom: Add support for Qcom SMEM parser Date: Tue, 17 Nov 2020 23:09:08 +0530 Message-Id: <20201117173909.23585-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> References: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_123943_541533_5F0C3139 X-CRM114-Status: GOOD ( 13.99 ) 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:644 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:39:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 325519 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4363177ils; Tue, 17 Nov 2020 09:40:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVCawsVR6AT0QGzQIcJ1doVg+aMmDOSNz51LywFBGWyCUVdGy339TqsMKPS/klDZ5XyE6P X-Received: by 2002:a37:7c81:: with SMTP id x123mr616193qkc.383.1605634804220; Tue, 17 Nov 2020 09:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605634804; cv=none; d=google.com; s=arc-20160816; b=GFBZSpRX0x+1rtfEl+dRPhwt+yxULFD+FtPRiF300jy8JBNUDc7GYuxyntlvhkmnuB so50reJAZgFSYEufpugK+SP/sKK0a/f6Tzypi5d4mb3/+aTWbUdwicrTXEFbDoZi7MUc csdINwHyvPPrFTjOTBL5Hrod4PsJakwH+B/sJ34jc/57LpkTu5hFMeZ4TKTPlZxiHNoQ dwtKYujn2J7RLJnchijjBwtKk9xbm8rH6gfJH8ol8fEZ2HxEXqgBfw7sb6Sq5MtkFMS4 nG321G3rmfD9QNHTC9G6wkhUn7jsHIUVzSPq87jYNMZrREg4CLsTmD42Kj5yZ85lD/vQ MdKA== 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=KE896ySUgDQPlHVolJ/LCQr+B5+yTlLXaFD1GEo/CUjvSpNgRdn5qZSolml7GO4WN8 m3+8VYB/06SJG72Cob4mzzDjLO+seHSoBuyaWk3Gv3m4DVXVMUQ88NXmQDzV3qrpE/kX +O9N5K97LDUcUO3TVXEeqBuZQbG6/lg5clZJahsVZiBHtaiIf4zPT9W8Ah4T/CTX1cJL rLOfYxU4hAH508mtLt6Buqe7HNIZtM7xarY4hgzjkp7koCrpkEe2rtLpCqngolZOjvus RgL38WR0ADEcMxaSg7guUsHFM84vYJQWYgYeMEIjHV4czmN+DDRf6/IqUo12hk98yaPJ 8vDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=loMcymDk; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=roejm7Op; 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 l16si10972590qvo.152.2020.11.17.09.40.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:40:04 -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=loMcymDk; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=roejm7Op; 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=loMcymDkt1OJyWGHvBpB5oapvX 9TqeNu4/WSJs3AP1zrmVCZwpmSIEnEF+uRTp9GW6rG/BG2DF3x+/7XvpwjJyiPMyo5BsLVDpjSNx6 1iI3VBwo2Ux8dWzPPChuHquPEuvSNXb0bGSi4sPJBEz3BmbsNkJbvsFEjiuwmv+3knQjKQMKHCwWC qyPH3KQM/Haa5hboPCTBUrAa2LPUbXqIwtvegHVaZA9SewZXTmUKEAQNvTcGJz8dxNhXC7dxXA9LW zT05kl0cS+MRibh778vwrvcXZgmCqp2Z9k1xY3HfM13Wzp6XHjRUGvOa2OqT6ngffkRQhdr3exL2+ kZSw+kLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xN-00051S-ML; Tue, 17 Nov 2020 17:39:53 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xL-0004yo-5N for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:39:52 +0000 Received: by mail-pj1-x1044.google.com with SMTP id mn12so687737pjb.1 for ; Tue, 17 Nov 2020 09:39:47 -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=roejm7Op9Zg7DIDxR2z85W2idQGhDnJWcLxRVK9/FJgE4xP73woVLLM3cWiZlNukme 7+xYxPb12cPLd+Nwpof5LdVtyYyAhs6qQ7FHzo4sK3gHh0Xx2Wtv8G9zgI36HcQnBFQm wKGkcZAMWGvS2Hqr7Gu0t5WgVOHwqNbmEGgziVOhQGPyvC011MB/JsNYjgpt3LFLUGPo Acd4A10Ljb3knE8r1khe/l2wZxdZajD+HcPx7IjGqAReaUTDHa3ri/fAE6xuo7CA/MpO zYoRNRYMQ9DHMlSXNT+ckd/V5j9z/Nizr4H4DFkCaRPLwCRDeUxnQxd13waGTyExsCLg ECdg== 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=dL6ooku9Vt8I1FVQZSrB7lbL0fa3Ilu5JpuyieX6PAzWZFmvNBlSka16OAN89DprxO yXKF0yPoBMTUScRxg461/3MFyey/hUjP18u6UgUbF/wfo58Y1J10hN9vlOThdcDPZcr9 OHC50OPaqjDDF8uzg9lzVT13oTGdJOWaUd08VGZn4QOY1JAHES8LJJoke3CSnMh4HXkz pfhDNViOrgNKldegxNbkOWe3ghTAAebcw4QWJhSldTTNr0k4/pTJ0zsAXYUojkK/U7ox lNHBW35OiIASsHhPeKJeNm+IKVtCCXdHIw0pbLkNfB5xUkjpVi0g8muDBFsdWPvohGTe wh4g== X-Gm-Message-State: AOAM532plBU4gTViAe/ZxaOa0EhetfvRq4/0L2yPTdE2v9YSJwi4XtdU 3TK/r4x3pEsaR3IER1dEUkkc X-Received: by 2002:a17:90b:a54:: with SMTP id gw20mr198504pjb.178.1605634785524; Tue, 17 Nov 2020 09:39:45 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id a21sm1751330pjq.37.2020.11.17.09.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:44 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Tue, 17 Nov 2020 23:09:09 +0530 Message-Id: <20201117173909.23585-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> References: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_123951_229516_9CE02CAD X-CRM114-Status: GOOD ( 14.15 ) 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:1044 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;