* [PATCH] ASoC: cht_bsw_rt5645: Fix leftover kmalloc
@ 2016-11-22 17:11 Takashi Iwai
2016-11-23 3:44 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2016-11-22 17:11 UTC (permalink / raw)
To: Mark Brown
Cc: Vinod Koul, alsa-devel, Mengdong Lin, Liam Girdwood,
Pierre-Louis Bossart
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>
---
sound/soc/intel/boards/cht_bsw_rt5645.c | 6 +++---
1 file 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 {
struct cht_mc_private {
struct snd_soc_jack jack;
struct cht_acpi_card *acpi_card;
+ char codec_name[16];
};
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)
int i;
struct cht_mc_private *drv;
struct snd_soc_card *card = snd_soc_cards[0].soc_card;
- char codec_name[16];
struct sst_acpi_mach *mach;
const char *i2c_name = NULL;
int dai_index = 0;
@@ -374,12 +374,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
}
card->dev = &pdev->dev;
mach = card->dev->platform_data;
- sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
+ sprintf(drv->codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
/* set correct codec name */
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) {
- card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);
+ card->dai_link[i].codec_name = drv->codec_name;
dai_index = i;
}
--
2.10.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: cht_bsw_rt5645: Fix leftover kmalloc
2016-11-22 17:11 [PATCH] ASoC: cht_bsw_rt5645: Fix leftover kmalloc Takashi Iwai
@ 2016-11-23 3:44 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2016-11-23 3:44 UTC (permalink / raw)
To: Takashi Iwai
Cc: Mengdong Lin, alsa-devel, Mark Brown, Liam Girdwood,
Pierre-Louis Bossart
On Tue, Nov 22, 2016 at 06:11:08PM +0100, Takashi Iwai wrote:
> 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.
>
Acked-by: Vinod Koul <vinod.koul@intel.com>
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-23 3:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 17:11 [PATCH] ASoC: cht_bsw_rt5645: Fix leftover kmalloc Takashi Iwai
2016-11-23 3:44 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.