From patchwork Tue Jun 9 13:34:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 49658 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B6CAD245D4 for ; Tue, 9 Jun 2015 13:35:16 +0000 (UTC) Received: by wibdt2 with SMTP id dt2sf4534471wib.3 for ; Tue, 09 Jun 2015 06:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=52RvuFXXgX2cKaFck7Dt4nD8tI3q2UlVVigc0p592mU=; b=ajCK8Pt3NAbw77b1P+k2m3lkHTbemQ6LsTNhMZPXPllDNasKN/KQtdL3eTJh1unlay EldPsZhw7jHL2ePToLXDe0vW6GjOiZ59brNr+p/9GqHZdfsP3bH1KhC6vQgXZbcacocb J6HkhVIGAnUjIIbQXLSotDZT0N9xp0iwAc1x5CPkIeebLORwQoxeuanUrhL8BjCljNWX uzJMM4jopbO6cbtWV9mz9D4xBtdtWIc2BPBb+KIGItRcoHYeUmuqTaVidiEFJ53SeKnf V8Kad0zkkDy1gavWwKKWVoNaFwzTXlWciWivodh1F9JEy2tywjp+A+bumOPI9nXZZBKn upSA== X-Gm-Message-State: ALoCoQk404ihSkbo2MGZHLDo+wGdDvMn1xZgQLD4yavySQcPx8uO1cKoRhRY3tpnPDjjvvQv/To8 X-Received: by 10.152.19.161 with SMTP id g1mr21880586lae.8.1433856916029; Tue, 09 Jun 2015 06:35:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.171 with SMTP id az11ls75900lab.107.gmail; Tue, 09 Jun 2015 06:35:15 -0700 (PDT) X-Received: by 10.152.9.137 with SMTP id z9mr2418523laa.68.1433856915889; Tue, 09 Jun 2015 06:35:15 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id ot8si5750904lbb.177.2015.06.09.06.35.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 06:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laew7 with SMTP id w7so12431782lae.1 for ; Tue, 09 Jun 2015 06:35:15 -0700 (PDT) X-Received: by 10.152.29.34 with SMTP id g2mr22633276lah.73.1433856915604; Tue, 09 Jun 2015 06:35:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2616860lbb; Tue, 9 Jun 2015 06:35:14 -0700 (PDT) X-Received: by 10.69.25.41 with SMTP id in9mr38984599pbd.80.1433856913842; Tue, 09 Jun 2015 06:35:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rd8si9009815pab.72.2015.06.09.06.35.13; Tue, 09 Jun 2015 06:35:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753631AbbFINfL (ORCPT + 5 others); Tue, 9 Jun 2015 09:35:11 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:38104 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752472AbbFINfK (ORCPT ); Tue, 9 Jun 2015 09:35:10 -0400 Received: by wibdq8 with SMTP id dq8so17112743wib.1 for ; Tue, 09 Jun 2015 06:35:09 -0700 (PDT) X-Received: by 10.180.104.167 with SMTP id gf7mr8600310wib.3.1433856908902; Tue, 09 Jun 2015 06:35:08 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-99-231-135.as13285.net. [2.99.231.135]) by mx.google.com with ESMTPSA id u9sm9494335wju.44.2015.06.09.06.35.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jun 2015 06:35:07 -0700 (PDT) From: Srinivas Kandagatla To: Patrick Lai , Mark Brown , kwestfie@codeaurora.org Cc: Rob Herring , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically. Date: Tue, 9 Jun 2015 14:34:21 +0100 Message-Id: <1433856861-15433-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch moves static allocation of snd_soc_card to dynamic allocation, the reason to do this is to avoid holding up any dangling pointers in this static structures. And I see no use for having this struct as static given that the card->name is also populated dynamically from dt. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/storm.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c index b8bd296..ee06613 100644 --- a/sound/soc/qcom/storm.c +++ b/sound/soc/qcom/storm.c @@ -69,11 +69,6 @@ static struct snd_soc_dai_link storm_dai_link = { .ops = &storm_soc_ops, }; -static struct snd_soc_card storm_soc_card = { - .name = "ipq806x-storm", - .dev = NULL, -}; - static int storm_parse_of(struct snd_soc_card *card) { struct snd_soc_dai_link *dai_link = card->dai_link; @@ -99,14 +94,13 @@ static int storm_parse_of(struct snd_soc_card *card) static int storm_platform_probe(struct platform_device *pdev) { - struct snd_soc_card *card = &storm_soc_card; + struct snd_soc_card *card; int ret; - if (card->dev) { - dev_err(&pdev->dev, "%s() error, existing soundcard\n", - __func__); - return -ENODEV; - } + card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + if (!card) + return -ENOMEM; + card->dev = &pdev->dev; platform_set_drvdata(pdev, card); @@ -129,7 +123,6 @@ static int storm_platform_probe(struct platform_device *pdev) ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret == -EPROBE_DEFER) { - card->dev = NULL; return ret; } else if (ret) { dev_err(&pdev->dev, "%s() error registering soundcard: %d\n",