From patchwork Thu Nov 19 07:13:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 328644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1595C6379F for ; Thu, 19 Nov 2020 07:13:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FBB922259 for ; Thu, 19 Nov 2020 07:13:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fF2c5BlB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725917AbgKSHNb (ORCPT ); Thu, 19 Nov 2020 02:13:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbgKSHNa (ORCPT ); Thu, 19 Nov 2020 02:13:30 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19A8C0613CF for ; Wed, 18 Nov 2020 23:13:30 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id t37so3321920pga.7 for ; Wed, 18 Nov 2020 23:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jVl81ZS9fFrGd+ufPYRPV6WNHXbkD50mNDrAZQnv39A=; b=fF2c5BlBENboF8Y1Nu+N/7xWoSQULa2VjGFTzkM/PYZUg9jiRfN5JYusVOEWtV9MPl jJYZmS5J/IlXmMNYIuXyb4V/n5xXtnf38pU9c4PJe4GeKYVCVvQgNz75dWekVZZNX+6o eprwSUaJ7Ouz1qi/CaVZ3on68RVP1ntMBe+7+00OyIW0/m2t7EnL1JRgLPKsvyae9K6H ckDeHn+mGx9YaSAe9sYoxmEPsIYolSMkg3ccFTNiYHlLeWAd79KOw/Ses7BqCK05kjSD qRae4SK6ns5N+JKHV4+bdFF1oyoso50x9fKdpCKBiwMrqyXG7TEJ5klCi1US9VVr5G0H AsXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jVl81ZS9fFrGd+ufPYRPV6WNHXbkD50mNDrAZQnv39A=; b=Duo+gU7uSPEMSyTlCWcOrAJtwNiGCpBfW6ZtRhPvLrlYN8qwdNEuOlpCnKP3fTVy22 zpS+ZRa1Ik0PpdSbirj51uKkxJGLgjYxyq/aMYmkfWXykBOKSPq2Ggq6iLmum01RsrOh O/6DZAYDkNzObD14tT2c39mewUPNAAXGdZCkmO53Lz6UrqRVMnammN+u+93mqj0lOw5L dD+LDxgL8VqjQ9oKCLKdaeT6v9wo2sIuWVicFyXnoDBazNZszL8E25YDd42YdoLlIrPn F6ug0E+VM9wIeAeJXKKqPz1l33Ebx2EO0jR2b9D4pXUKDhgXbFv+OfQjsVhkplzpghXT L7eQ== X-Gm-Message-State: AOAM532i/5os7HEo+6jGqRa7Pct5UF8gecEN1IVPgD+XFW75S6BdDsDu slI9eTPkUu0ZNdbQxJ+MPq65 X-Google-Smtp-Source: ABdhPJy2OIX2ioBGmz//Ste9wS23OQDzJmRj//wqH1/EVhXbCvQefRNgQX340DjN0ZtVUT25ucLIXg== X-Received: by 2002:a17:90b:ec6:: with SMTP id gz6mr1192362pjb.142.1605770010350; Wed, 18 Nov 2020 23:13:30 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 12sm5491577pjt.25.2020.11.18.23.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:29 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Cc: bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 1/4] dt-bindings: mtd: partitions: Add binding for Qcom SMEM parser Date: Thu, 19 Nov 2020 12:43:05 +0530 Message-Id: <20201119071308.9292-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> References: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 diff --git a/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml new file mode 100644 index 000000000000..cf3f8c1e035d --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/qcom,smem-part.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm SMEM NAND flash partition parser binding + +maintainers: + - Manivannan Sadhasivam + +description: | + The Qualcomm SoCs supporting the NAND controller interface features a Shared + Memory (SMEM) based partition table scheme. The maximum partitions supported + varies between partition table revisions. V3 supports maximum 16 partitions + and V4 supports 48 partitions. + +properties: + compatible: + const: qcom,smem-part + +required: + - compatible + +additionalProperties: false + +examples: + - | + flash { + partitions { + compatible = "qcom,smem-part"; + }; + }; From patchwork Thu Nov 19 07:13: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: 328643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1348AC64E7C for ; Thu, 19 Nov 2020 07:13:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B26052222A for ; Thu, 19 Nov 2020 07:13:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qgWlpJRt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726379AbgKSHNm (ORCPT ); Thu, 19 Nov 2020 02:13:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbgKSHNl (ORCPT ); Thu, 19 Nov 2020 02:13:41 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5F9AC0613CF for ; Wed, 18 Nov 2020 23:13:41 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id w4so3380941pgg.13 for ; Wed, 18 Nov 2020 23:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aapWpWlyJG4BRZvNWpxnSiKXabtbA1WEoNDKMnXBWMg=; b=qgWlpJRtvQvY++Dn2/UpaiG/tLsPm+RlkTuBkKurklKGiW6comp6026pG/rrJE5H9s Jvk8jJuWq4Rmp7o3owcGR826LFXlnudvx23sSDp7tOXziagznab4Xu/yqFRqW91nuLpg oddCSmZB+jJQZcvwEZy+kadZpuFNxNRVyHJOXrjEsjC3XSrDx5kYfxTW9YHmyjS9YH5o sgRWaev0MOcbaeZrDF5y0KNkiRpi/kko7dycJ4xxtMSLRG1WgLOpHPXTmUa8T0Lwj487 Z2bzhg0NQVo1PhiaH/PrUtoyRFbTUM47fiwe92cnxelpWzoWVcdqwTR5ci+L8dRHwkQR Ixgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aapWpWlyJG4BRZvNWpxnSiKXabtbA1WEoNDKMnXBWMg=; b=MhF3gcX4cxyLnB+AhfK5QfsB/jp68cUnWp4MqLiPftzpCMJi9HRJGsp7cC+M4eH5jT RLkYvPIqxZy9tEFGagYuuy5GIwj/Fhe/1bVn9N0pYL0LBWW4aJN/44B9a9H3sOjKLccS Hllnfy2B47WdnE3YTrGuzJXrCchx4k+s7F0m9x4EJ3C/ef+zhJD3dGFEYco8phKCUKQg OkRT1VBenq/BJsNy7/DrGDCjiH2rrlvAG7Ry9ar/j2pephPN+RBGFh/PzSS6zj5XhiaY Zo34OMvIIEMM+55aGRcd7gsNXME8NVK7hdFIban6Lb4YnxDaCJON7K7lYY0RilFqsQ1S +TRw== X-Gm-Message-State: AOAM532BfavyQgZCDlgBut5PO8hfmCtCmzcwENRmQ90+T9MEy3XIXD22 7rI8wf9tJOfE/NqTC6SdbWIj X-Google-Smtp-Source: ABdhPJwcInvozb/zTCyAg8emYQVQFmIX2bAwu06mXAwj/87oGn8Q4Nm3DbiDeHZzBrzSc5OLOLtxVA== X-Received: by 2002:a62:8608:0:b029:18b:a8e:ee9 with SMTP id x8-20020a6286080000b029018b0a8e0ee9mr8008802pfd.65.1605770021344; Wed, 18 Nov 2020 23:13:41 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 12sm5491577pjt.25.2020.11.18.23.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 23:13:40 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Cc: bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam , Linus Walleij Subject: [PATCH v3 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Thu, 19 Nov 2020 12:43:08 +0530 Message-Id: <20201119071308.9292-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> References: <20201119071308.9292-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In the case of failure while parsing the partitions, the iterator should be pre decremented by one before starting to free the memory allocated by kstrdup(). Because in the failure case, kstrdup() will not succeed and thus no memory will be allocated for the current iteration. Cc: Linus Walleij Fixes: 1fca1f6abb38 ("mtd: afs: simplify partition parsing") Reviewed-by: Linus Walleij Signed-off-by: Manivannan Sadhasivam --- drivers/mtd/parsers/afs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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;