From patchwork Tue Nov 17 17:48:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 326306 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=unavailable 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 44384C63777 for ; Tue, 17 Nov 2020 17:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04AFC2465E for ; Tue, 17 Nov 2020 17:49:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hkLaoiz2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730220AbgKQRtD (ORCPT ); Tue, 17 Nov 2020 12:49:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729446AbgKQRtC (ORCPT ); Tue, 17 Nov 2020 12:49:02 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CA10C0613CF for ; Tue, 17 Nov 2020 09:49:01 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id oc3so912670pjb.4 for ; Tue, 17 Nov 2020 09:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jVl81ZS9fFrGd+ufPYRPV6WNHXbkD50mNDrAZQnv39A=; b=hkLaoiz2lCG8tln82zm7qfOl0cDYLureyURBuaXH0PW+24+gvVK577hO5cNqI/F2aV +GzMDYmWlne/pkBM+dzDfJnQpgrLbniED7sUDitRpnxxKZjuzR8aLV0dYiozsnsOmwn1 9UHgFxx1EGsPczmBiB4PDynbbKEf8EDnIK5/jsO+eUuGGwO2CW6vU/uolWJExRUfW0Ig G4Fn3d8qgVU/z/93B6Yaq4oInZigk7lXpZpyUcXiaajbhasY2FeLedNhRlai/r3pYYrb XXb4u2iaMe7ReCIl9scVlGdGRvnn7UWb7invf8vBpD0I8VswVGhoBQLc5gUaHPzdyVph yqCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jVl81ZS9fFrGd+ufPYRPV6WNHXbkD50mNDrAZQnv39A=; b=kPNBdiV4WiJGusTxRSlYKitpVIq6XszsHalMWqEOom1do76CPpW053P0FFA1Ie+jbH fVRlOZFMqKh7yjRDP0VKU1YYJUJQPZKTnVIYTofYJBGS4DEorDHYKyOZ3+1XhDfiHOq6 F/bNRiRCY6Cn2KGzQcshMs/HPfR7azjDEsEIg7/DPUtyN883/qw9tnHyMdO4S+NYEDVj 3Cl/ISgFOYytv1fZQq4pO+ZIFuR7KFsOCocjqusN/AXs1bV8zA3UDqx3HgJ1C/iY6BQN IRiUub/NbR5OVSsb7Tyx9vp0XQP9ASOobjWiEKsvWU7aJzdq2FhcgOEc2FEC/hpXxH9q 9t8g== X-Gm-Message-State: AOAM531RqW3S28XMgZD2M/Il+juyckCuiwsqbiDJapzYJKgm/RSTX9it ETUnLLw/N3Nwxos5q7FTJ/UW X-Google-Smtp-Source: ABdhPJxZXnb+Y1pWwUT4dnxesIRY7MEakGxf2a8hxor9743lNW9sz1zrysWJ+bDn30ZzJWekwpI2UA== X-Received: by 2002:a17:90a:1b44:: with SMTP id q62mr201421pjq.59.1605635340003; Tue, 17 Nov 2020 09:49:00 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 192sm22222810pfz.200.2020.11.17.09.48.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:48:59 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org 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 v2 1/4] dt-bindings: mtd: partitions: Add binding for Qcom SMEM parser Date: Tue, 17 Nov 2020 23:18:42 +0530 Message-Id: <20201117174845.28684-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> References: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> 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 --- .../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 Tue Nov 17 17:48:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 326304 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=unavailable 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 E5C26C64E7C for ; Tue, 17 Nov 2020 17:49:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94DA221734 for ; Tue, 17 Nov 2020 17:49:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GrQmJSal" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730282AbgKQRtM (ORCPT ); Tue, 17 Nov 2020 12:49:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730257AbgKQRtL (ORCPT ); Tue, 17 Nov 2020 12:49:11 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80E71C0613CF for ; Tue, 17 Nov 2020 09:49:11 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id t8so1464092pfg.8 for ; Tue, 17 Nov 2020 09:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EAf9d4gGWEUWE1b+AMgq6WQ0FcZNv1uCLoEh96U6HDQ=; b=GrQmJSaliPTve3DL04A9GAepxzDBPQmaJDXflI0uIc24Ceqru5Te8SBteMXYibBiWV YXtyBkZcp4alV78euGq8ZrdXrY/s1xTOqwOzjdB/goMB33KUlG5kJWFx/V0Hqrk3JZEp zw7ndp6YX9rmihiKPQuebdAS2Wg2Jl1+n+zNJJHekxbJkjfpKusp/zA2T2t21GcxUBBV sZr+xgHWq6+/6X33ZHMmafEYZVgWboH6fcuIKZcdfC7uKZ/Gc2XP02Uwep7dMXIQHRUe AZFf9CI2yybVt/jWzI+IT2jw9m6POx/FLGVpicrbqCfBClD5HoQVjXuKaz0ESjdzURvc ZuuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EAf9d4gGWEUWE1b+AMgq6WQ0FcZNv1uCLoEh96U6HDQ=; b=qugzQ59PIA8uAibrg2CLHELdtPq7PTVpM4wTv+wSS4KeUNhEoU5tfsYURidxbeQpLF 7t1Df/NZ7OzDsknV/guoTlN70VLiqb8w9kQFcncXudMvWS91L7L1lIKT4OiF9DKZejZv ErwUQmESNO9LQn6oSNa+aj/yKBXf87y3mc8mK8oRHfb3tziGtMwrm+t8vdFViGCz1WpY pHEzcpScfolBEvbnNfkLJ4/1GDWUB16kYqs8UUP2knz5mZQOsCzDA2uWw80rjJ3QsaBF O9j96Ze2XBz9eDenSd/lO/6DxpxZ9Rtvbnacw97esZzuVSeAid+dZhP5Br93FR4RdJej DjtA== X-Gm-Message-State: AOAM530wtEY7OaHot11OQF3TwoEpg63/uGwrna6v/cTuY+w+i96RgN25 5W9h/Yl+IBmzDck8dcFyV0gG X-Google-Smtp-Source: ABdhPJwxqq2K6RhfPEieDLWKql41cofe+24CsQYp9jpMXliRovzgKa7QgkEGeFPlq1NqV99mGfsR1w== X-Received: by 2002:a65:55ce:: with SMTP id k14mr4432790pgs.65.1605635350991; Tue, 17 Nov 2020 09:49:10 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id 192sm22222810pfz.200.2020.11.17.09.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:49:10 -0800 (PST) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org 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 v2 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Tue, 17 Nov 2020 23:18:45 +0530 Message-Id: <20201117174845.28684-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> References: <20201117174845.28684-1-manivannan.sadhasivam@linaro.org> 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") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Linus Walleij --- 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;