From patchwork Wed Mar 25 10:13:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 6089921 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B41A9BF90F for ; Wed, 25 Mar 2015 10:17:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECE71202F2 for ; Wed, 25 Mar 2015 10:17:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 95A842037D for ; Wed, 25 Mar 2015 10:17:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0F3932652B7; Wed, 25 Mar 2015 11:17:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 444EB2651A8; Wed, 25 Mar 2015 11:17:20 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B43862651CF; Wed, 25 Mar 2015 11:17:18 +0100 (CET) Received: from opensource.wolfsonmicro.com (opensource.wolfsonmicro.com [80.75.67.52]) by alsa0.perex.cz (Postfix) with ESMTP id 87A99265132 for ; Wed, 25 Mar 2015 11:17:11 +0100 (CET) Received: from localhost.localdomain (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id A74383B40FD; Wed, 25 Mar 2015 10:17:10 +0000 (GMT) From: Charles Keepax To: broonie@kernel.org Date: Wed, 25 Mar 2015 10:13:28 +0000 Message-Id: <1427278408-27134-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com, nikesh@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: DAPM: Fix build warning X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP commit c66150824b8a ("ASoC: dapm: add code to configure dai link parameters") introduced the following build warning: sound/soc/soc-dapm.c: In function 'snd_soc_dapm_new_pcm': sound/soc/soc-dapm.c:3389:4: warning: passing argument 1 of 'snprintf' discards 'const' qualifier from pointer target type snprintf(w_param_text[count], len, This patch fixes this by adding a non-const temporary variable to hold the value as it is created before assigning to the entry in w_param_text. Signed-off-by: Charles Keepax --- sound/soc/soc-dapm.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 049b300..7640370 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3376,18 +3376,20 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, for (count = 0 ; count < num_params; count++) { if (!config->stream_name) { + char *anon_name; + dev_warn(card->dapm.dev, "ASoC: anonymous config %d for dai link %s\n", count, link_name); len = strlen("Anonymous Configuration ") + 3; - w_param_text[count] = - devm_kzalloc(card->dev, len, GFP_KERNEL); - if (!w_param_text[count]) { + anon_name = devm_kzalloc(card->dev, len, GFP_KERNEL); + if (!anon_name) { ret = -ENOMEM; goto outfree_link_name; } - snprintf(w_param_text[count], len, + snprintf(anon_name, len, "Anonymous Configuration %d", count); + w_param_text[count] = anon_name; } else { w_param_text[count] = devm_kmemdup(card->dev, config->stream_name,