diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2015-03-25 07:22:35 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-25 11:26:35 -0400 |
commit | 46172b6c26667133b9945b916b6223cc87bbf10c (patch) | |
tree | 0b7b38f34c1202433450b9d0f26220c7eb74d0fc | |
parent | c66150824b8a809a502fd833fa9b18082cd89a39 (diff) |
ASoC: dapm: Fix build warning
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | 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 6828b4ed5447..e5ec9d7133ae 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3356,7 +3356,6 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, | |||
3356 | { | 3356 | { |
3357 | struct snd_soc_dapm_widget template; | 3357 | struct snd_soc_dapm_widget template; |
3358 | struct snd_soc_dapm_widget *w; | 3358 | struct snd_soc_dapm_widget *w; |
3359 | size_t len; | ||
3360 | char *link_name; | 3359 | char *link_name; |
3361 | int ret, count; | 3360 | int ret, count; |
3362 | unsigned long private_value; | 3361 | unsigned long private_value; |
@@ -3376,28 +3375,26 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, | |||
3376 | if (!w_param_text) | 3375 | if (!w_param_text) |
3377 | return -ENOMEM; | 3376 | return -ENOMEM; |
3378 | 3377 | ||
3379 | len = strlen(source->name) + strlen(sink->name) + 2; | 3378 | link_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-%s", |
3380 | link_name = devm_kzalloc(card->dev, len, GFP_KERNEL); | 3379 | source->name, sink->name); |
3381 | if (!link_name) { | 3380 | if (!link_name) { |
3382 | ret = -ENOMEM; | 3381 | ret = -ENOMEM; |
3383 | goto outfree_w_param; | 3382 | goto outfree_w_param; |
3384 | } | 3383 | } |
3385 | snprintf(link_name, len, "%s-%s", source->name, sink->name); | ||
3386 | 3384 | ||
3387 | for (count = 0 ; count < num_params; count++) { | 3385 | for (count = 0 ; count < num_params; count++) { |
3388 | if (!config->stream_name) { | 3386 | if (!config->stream_name) { |
3389 | dev_warn(card->dapm.dev, | 3387 | dev_warn(card->dapm.dev, |
3390 | "ASoC: anonymous config %d for dai link %s\n", | 3388 | "ASoC: anonymous config %d for dai link %s\n", |
3391 | count, link_name); | 3389 | count, link_name); |
3392 | len = strlen("Anonymous Configuration ") + 3; | ||
3393 | w_param_text[count] = | 3390 | w_param_text[count] = |
3394 | devm_kzalloc(card->dev, len, GFP_KERNEL); | 3391 | devm_kasprintf(card->dev, GFP_KERNEL, |
3392 | "Anonymous Configuration %d", | ||
3393 | count); | ||
3395 | if (!w_param_text[count]) { | 3394 | if (!w_param_text[count]) { |
3396 | ret = -ENOMEM; | 3395 | ret = -ENOMEM; |
3397 | goto outfree_link_name; | 3396 | goto outfree_link_name; |
3398 | } | 3397 | } |
3399 | snprintf(w_param_text[count], len, | ||
3400 | "Anonymous Configuration %d", count); | ||
3401 | } else { | 3398 | } else { |
3402 | w_param_text[count] = devm_kmemdup(card->dev, | 3399 | w_param_text[count] = devm_kmemdup(card->dev, |
3403 | config->stream_name, | 3400 | config->stream_name, |