diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-11-22 12:11:08 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 05:39:29 -0500 |
commit | d61a969f0e941de5ec682d6236cc9d5fa54bf85b (patch) | |
tree | 41716860bbcdc562cf1b096a33dfdafdd109806f /sound/soc/intel/boards | |
parent | 311742c40da94fed4e4492c38ed456963ed4ecd6 (diff) |
ASoC: cht_bsw_rt5645: Fix leftover kmalloc
commit a823a17981a73faa115bc0f7eda0190763075e2c upstream.
cht_bsw_rt5645 driver allocates the own codec_id string but doesn't
release it. For simplicity, put the string in cht_mc_private; then
the string is allocated in a shot and released altogether.
Fixes: c8560b7c917f ("ASoC: cht_bsw_rt5645: Fix writing to string literal")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/soc/intel/boards')
-rw-r--r-- | sound/soc/intel/boards/cht_bsw_rt5645.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index 56056ed7fcfd..16c94c45ce50 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c | |||
@@ -44,6 +44,7 @@ struct cht_acpi_card { | |||
44 | struct cht_mc_private { | 44 | struct cht_mc_private { |
45 | struct snd_soc_jack jack; | 45 | struct snd_soc_jack jack; |
46 | struct cht_acpi_card *acpi_card; | 46 | struct cht_acpi_card *acpi_card; |
47 | char codec_name[16]; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card) | 50 | static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card) |
@@ -354,7 +355,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev) | |||
354 | int i; | 355 | int i; |
355 | struct cht_mc_private *drv; | 356 | struct cht_mc_private *drv; |
356 | struct snd_soc_card *card = snd_soc_cards[0].soc_card; | 357 | struct snd_soc_card *card = snd_soc_cards[0].soc_card; |
357 | char codec_name[16]; | ||
358 | struct sst_acpi_mach *mach; | 358 | struct sst_acpi_mach *mach; |
359 | const char *i2c_name = NULL; | 359 | const char *i2c_name = NULL; |
360 | int dai_index = 0; | 360 | int dai_index = 0; |
@@ -374,12 +374,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev) | |||
374 | } | 374 | } |
375 | card->dev = &pdev->dev; | 375 | card->dev = &pdev->dev; |
376 | mach = card->dev->platform_data; | 376 | mach = card->dev->platform_data; |
377 | sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id); | 377 | sprintf(drv->codec_name, "i2c-%s:00", drv->acpi_card->codec_id); |
378 | 378 | ||
379 | /* set correct codec name */ | 379 | /* set correct codec name */ |
380 | for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) | 380 | for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) |
381 | if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) { | 381 | if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) { |
382 | card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL); | 382 | card->dai_link[i].codec_name = drv->codec_name; |
383 | dai_index = i; | 383 | dai_index = i; |
384 | } | 384 | } |
385 | 385 | ||