* [PATCH v3] ASoC: dapm: Fix build warning
@ 2015-03-25 11:22 Charles Keepax
2015-03-25 15:27 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2015-03-25 11:22 UTC (permalink / raw)
To: broonie; +Cc: lgirdwood, nikesh, alsa-devel, linux-kernel, patches, tiwai
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 switching to using devm_kasprintf. This also
saves a couple of lines of code.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
Changes since v2:
- Use devm_kasprintf
sound/soc/soc-dapm.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 049b300..4bd2a6f 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3346,7 +3346,6 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
{
struct snd_soc_dapm_widget template;
struct snd_soc_dapm_widget *w;
- size_t len;
char *link_name;
int ret, count;
unsigned long private_value;
@@ -3366,28 +3365,26 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
if (!w_param_text)
return -ENOMEM;
- len = strlen(source->name) + strlen(sink->name) + 2;
- link_name = devm_kzalloc(card->dev, len, GFP_KERNEL);
+ link_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-%s",
+ source->name, sink->name);
if (!link_name) {
ret = -ENOMEM;
goto outfree_w_param;
}
- snprintf(link_name, len, "%s-%s", source->name, sink->name);
for (count = 0 ; count < num_params; count++) {
if (!config->stream_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);
+ devm_kasprintf(card->dev, GFP_KERNEL,
+ "Anonymous Configuration %d",
+ count);
if (!w_param_text[count]) {
ret = -ENOMEM;
goto outfree_link_name;
}
- snprintf(w_param_text[count], len,
- "Anonymous Configuration %d", count);
} else {
w_param_text[count] = devm_kmemdup(card->dev,
config->stream_name,
--
1.7.2.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v3] ASoC: dapm: Fix build warning
2015-03-25 11:22 [PATCH v3] ASoC: dapm: Fix build warning Charles Keepax
@ 2015-03-25 15:27 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-03-25 15:27 UTC (permalink / raw)
To: Charles Keepax
Cc: lgirdwood, nikesh, alsa-devel, linux-kernel, patches, tiwai
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
On Wed, Mar 25, 2015 at 11:22:35AM +0000, Charles Keepax wrote:
> commit c66150824b8a ("ASoC: dapm: add code to configure dai link
> parameters") introduced the following build warning:
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-25 15:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 11:22 [PATCH v3] ASoC: dapm: Fix build warning Charles Keepax
2015-03-25 15:27 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome