From patchwork Tue Jun 18 05:28:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 167107 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3755851ilk; Mon, 17 Jun 2019 22:29:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqz13ItHryuuwY2fHxBLnVgc9Y2LyvfYD+ALTDKH3Eq+PagdGNRY5s/N8Gkr1ZQy8Njjm6s8 X-Received: by 2002:a1c:e009:: with SMTP id x9mr1540403wmg.5.1560835755789; Mon, 17 Jun 2019 22:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560835755; cv=none; d=google.com; s=arc-20160816; b=DxiiaBGo9bdXjaF9xVt92iqQjkmZgqc9bxi/348SUTrXQdAisCxhtishDbF3z6RU6F rl0nSLPEpp/nCCbo/owEFTXtGALiG3mg0HF7MipNrRwBM7yIp//hfviarcCu24uP1iQo QM9dzMwXoUSFN7XEg18YWeGAQvbxCR/pMItNFWPCpfs6NWfoi3zQlWx/Q5uq9/RFz1Hi NkyM9N1v0Xyy7rcIqhJSvzEdGws8rD+74dazIyantb9DasN3aWBzium0YmyNq2rqKMJp j7Qz/THj1R2z2cXSbW1spEfBLUFBdQw927JAixwJsWyPfGXffxdEUU5hNc1x8v/1wTO3 K7dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:dkim-filter:delivered-to:dkim-signature:dkim-filter; bh=GoVrBynsn6613p2FlSYo9denYAjsl10gIBBjXa3Rfr0=; b=yTIbsviiHwmexn+qfLaE5N3Pn+/DJw1F9XLn4DHgbg7BoVYL3cSiGylJNaIpyVZmvt Cg8zgnJfIiBD5lKJb8ANnLhdPKfcPnE1tN4HwjP2+Ipzy2OskJQ3tHNApuNiSk9W1uE3 /1hYWKFaxegSmNWtwfHMgVMWiYQZHgcvNy/EHpGxwadUVPS/xpDeFXfr7rS+u9Kt/s+Z 25PqHHzcbpJlK3tQCjhQCD+WXyFAfFt52Dm8TgU2HwKFRBSDoiGM1EChKM1yaBtuTHUp O7c+JVjx8d+bwW29TnF/CqEELcvfl5xT7+jmLI6bT+V4tNDExvZGkGWIhAwzxKY49fPc S85g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=A5IAFWN7; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VuEodqM3; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTPS id c6si5552204wrm.290.2019.06.17.22.29.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 22:29:15 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=A5IAFWN7; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VuEodqM3; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B5044170E; Tue, 18 Jun 2019 07:28:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B5044170E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1560835754; bh=o7OIJn0kzrFvgdJNsrkpD3N+Zcc1TiZyUiuSTemeEAM=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=A5IAFWN7zNgap0IOccfGeDWxMRCkYsxmxWqrJdMhDdL5WKugQFhpnTi8mDAzP12Wl S9iG7cZ5D938o/JLsOtuRYWEz2FcKXOG35qGIG4R4Jq0PnXanel7D+O8Ogkw1mFpj3 l1neyywI1xXhM26nsrJlCmYCYNB+bZSHbhCqoPR0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3BE61F896DB; Tue, 18 Jun 2019 07:28:24 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 54BAFF8971C; Tue, 18 Jun 2019 07:28:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 37BE8F8075C for ; Tue, 18 Jun 2019 07:28:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 37BE8F8075C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VuEodqM3" Received: by mail-pg1-x543.google.com with SMTP id w10so2372747pgj.7 for ; Mon, 17 Jun 2019 22:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=SqAd1fx2aqjUroAge2OaNB4tSLlvMkP+JhWERXOSN8Y=; b=VuEodqM3GEhgspN5BcSZBejRWyu1yfMzsvbt/tZcCt5AtPf01DDmMcr/YxPt5la51Y eAazo1sgyFm7hHAzmylz7IJwsHgTOpM5k1si7TJ3FbDsRl6PPeJHejJL0OEIt4gS1GKH jR0XlMVF4O6H8x0vXenyxoUWmPaZQPyQb/Q46CfiDuoDd4AejRu2OH2TcvcoLt1KVvXz hUTwDSqW+gWtikzfUEbdnp2rkDshNdXzeKLjxt1jXI6h6gfIJ88g9KwpGLNLUDwgO1Hu R3Dd1X0fhutxGN+CDAGj/KHsrlAQKUqMMf725VQBhO+S4DbDoMz4CoqO6L9Amo24rp2K RHZw== 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; bh=SqAd1fx2aqjUroAge2OaNB4tSLlvMkP+JhWERXOSN8Y=; b=qDb/DEgIHOobVQMEiVrkOC985IHZzVDAu4I74zJWSWNW1GLUyqZY/0y9A5hM0r79wB ThgkoStnj09kRdO1at+a1jo87p0mJ7MWVWLVIfUObdPKW3GnHdhPubMSLqRI9u0yhk2T NcL23a2JupdQAHFZOyCcWO5/lXX4j7Rl/sQQBASEoYqpDckaJHmjF8jc1nKMUCQnqAnx TQ7vdpUTe5ZhUCDXFDfsaHqmxZbFJ5cp/wQiWknp/+JbJlFtVAnApiZhboQuBfvZ95zv Ri3ZIBd8gr+m/RX7x7czy/LdB6SjmQbzy3oBeZN0tbplX75yPDLv6qWEvBRdYUYD96mT pdeg== X-Gm-Message-State: APjAAAXJMFTWv4MBky8X9BlBLpvKaCeH7t8mAQzvxhlEG2bA+W+NEQxT SSybo9Xfv/GjL/GGEQXbT83WQw== X-Received: by 2002:a63:4a1f:: with SMTP id x31mr972877pga.150.1560835696219; Mon, 17 Jun 2019 22:28:16 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id 188sm13934085pfg.11.2019.06.17.22.28.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 22:28:15 -0700 (PDT) From: Bjorn Andersson To: Patrick Lai , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Date: Mon, 17 Jun 2019 22:28:13 -0700 Message-Id: <20190618052813.32523-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 Cc: linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: qcom: common: Fix NULL pointer in of parser X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" A snd_soc_dai_link_component is allocated and associated with the first link, so when the code tries to assign the of_node of the second link's "cpu" member it dereferences a NULL pointer. Fix this by moving the allocation and assignement of snd_soc_dai_link_components into the loop, giving us one pair per link. Fixes: 1e36ea360ab9 ("ASoC: qcom: common: use modern dai_link style") Signed-off-by: Bjorn Andersson --- sound/soc/qcom/common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.18.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index c7a878507220..97488b5cc515 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -42,17 +42,17 @@ int qcom_snd_parse_of(struct snd_soc_card *card) card->num_links = num_links; link = card->dai_link; - dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); - if (!dlc) - return -ENOMEM; + for_each_child_of_node(dev->of_node, np) { + dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); + if (!dlc) + return -ENOMEM; - link->cpus = &dlc[0]; - link->platforms = &dlc[1]; + link->cpus = &dlc[0]; + link->platforms = &dlc[1]; - link->num_cpus = 1; - link->num_platforms = 1; + link->num_cpus = 1; + link->num_platforms = 1; - for_each_child_of_node(dev->of_node, np) { cpu = of_get_child_by_name(np, "cpu"); platform = of_get_child_by_name(np, "platform"); codec = of_get_child_by_name(np, "codec");