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: 326316 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 0FCC0C2D0E4 for ; Tue, 17 Nov 2020 17:39:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A62732465E for ; Tue, 17 Nov 2020 17:39:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iMhheqEE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729638AbgKQRjf (ORCPT ); Tue, 17 Nov 2020 12:39:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbgKQRjf (ORCPT ); Tue, 17 Nov 2020 12:39:35 -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 CEEF6C0613CF for ; Tue, 17 Nov 2020 09:39:34 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id 62so16494444pgg.12 for ; Tue, 17 Nov 2020 09:39:34 -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=ETJ2JWdlbbTiCl4q714PCn2t8LAUd154sOyJ3P82zOPpq8pc7Lgib3upm8K4P1fgrj 3Ik0lrDqMFELV/bgYz7vIerajfRXele5nYPeGucc4qlfOj2iyaz3SCbkQxIPymUMURA0 O4zG5v75j1w/Uco+MJqhWbjLkjFv30sVvN98hsenRynITOoK+rxsH4UbTcyyPaWsvrf+ fBxNDAfqnUCL5aNjaEB2BLlpjPjvuXPO2SVgKbmIfatZeJj3PxMaQHvNSxBVbuzFSRIy wuABR9qBytPBGaxLaYOrda+YHafR6EsBmBm4vdNmux4OdyG7UZjtO0dsCFckjE6VKpsw MBRw== X-Gm-Message-State: AOAM533l5yk0F0hInLTkoRL0Vwnmjh1VPKlCgoNTwx4ojEYgmAv3wWyr nWPbT7ZDpZjxAy2oIZtshe4nGa15fFEB X-Google-Smtp-Source: ABdhPJyiyMmrvmPp7kwm8dB7Il6lF8A+hmI+MKoQZ7IM7qdwm41PZpdxi/RlvI+65FSOqv9cdsE5pA== 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 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 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> 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 | 31 +++++++++++++++++++ 1 file changed, 31 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..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: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: 326314 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 E81B9C5519F for ; Tue, 17 Nov 2020 17:40:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 843042465E for ; Tue, 17 Nov 2020 17:40:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r2l/3gDm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729673AbgKQRjn (ORCPT ); Tue, 17 Nov 2020 12:39:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729026AbgKQRjm (ORCPT ); Tue, 17 Nov 2020 12:39:42 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB65C061A04 for ; Tue, 17 Nov 2020 09:39:42 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id j5so10614658plk.7 for ; Tue, 17 Nov 2020 09:39:42 -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=MCtqQjEc39A03MOEg1Lk5cjU/VvBbRi/QrsETeyUrH/BV2hOkgkABMJRqxG1D1LcwM K0CF1trDXjEXAWUsmHPpGA1s/kT3vXOakn2apIptcG9/SAUtb/ExX/Y8hJxhhOhoAWjb ihscjoGjurvbUticJl87/DmkzkNNmpoucMhVrK5u2jRUmxl9Wnklyy6wb8IXYWoKM9Qy /DiUGPu/xB2ytlLxW6dyCQt2jwJknjpjythih/bUYgLRDrL85uONePK0NgafcjmBg+mP 9QjZtOBh5aVwWQzJa5TsEchPBmrnJON2DY5tZ3jE6KZtXvuDynnaA2mTXJ8UeaZM79mA sO2w== X-Gm-Message-State: AOAM533j2M0CqrbfSV1G9Iezsw10E1J5alLjyPMBJLKVRrIAvTqouH/n eBGS91krCHy9yQ8Zkm3H6Z5j X-Google-Smtp-Source: ABdhPJytZ53nOUmuWQePziE64A8vrYNi9roIBdKD3NZkAV3H7LGnxbo3XuNI+LOsKrUygy0Fgeberw== 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 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 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> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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(-) 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: 326310 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 CDD73C63798 for ; Tue, 17 Nov 2020 17:40:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 840652465E for ; Tue, 17 Nov 2020 17:40:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="roejm7Op" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729890AbgKQRjs (ORCPT ); Tue, 17 Nov 2020 12:39:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729504AbgKQRjq (ORCPT ); Tue, 17 Nov 2020 12:39:46 -0500 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06A8FC0617A6 for ; Tue, 17 Nov 2020 09:39:46 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id ei22so896123pjb.2 for ; Tue, 17 Nov 2020 09:39:46 -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=sOL1rGVBEdAZC+98jYgcZBvsFmPdyxJhrrsZaT1fa464Hsd2c9RivmMFhRqe2SfNMN U/aaPZbcC/B882CuZS6TvYrnH+5iA2W85sPkP9s7hUhj3VH1d9uwViSy2VjMo93Wk4My WN1NdHwX6zE3BPcHfmZ6t4haTxI7HSuXV16ur/UWrQwCWFDJRTyPfQt6TGHyFvFB+Fca vSucGXtdcX+CipBKW4UGuSjKGHyA2oMH1zjKy7Nc5mk7/gOirIxATuftvsWAsAnsAq6F FrRBw8h6rFQtRkV40CwZgYkMjGqUrlapfSeDN60JrIC69Eilg4VJ4hAnQFUY52hj06G5 6Nag== X-Gm-Message-State: AOAM532W80g73P0hWuKsaPEhDp24reJLJN8VAH7NVYsvtYdHubmFNNyD IzjyIHKYWILdzCAohGTY8Y3t X-Google-Smtp-Source: ABdhPJwB2H0ru1rDI9vN4pDM/1VqZieHatMHr5QNK9SyRs7wdkDFRvOEa/dKnxkDSTZFI1x7nSplCA== 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 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 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> 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 --- 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;