diff options
author | Carlo Caione <carlo@endlessm.com> | 2016-02-23 09:50:20 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-02-26 11:11:47 +0900 |
commit | c8560b7c917f8738f5d80dd516930edc1d05e4e4 (patch) | |
tree | a7de5e31b7d139cc7b924dd4d751ddb7a579e168 /sound/soc/intel | |
parent | 65b4bcb82967fd5a60694c3477e58a04a9170aea (diff) | |
download | op-kernel-dev-c8560b7c917f8738f5d80dd516930edc1d05e4e4.zip op-kernel-dev-c8560b7c917f8738f5d80dd516930edc1d05e4e4.tar.gz |
ASoC: cht_bsw_rt5645: Fix writing to string literal
We cannot use strcpy() to write to a const char * location. This is
causing a 'BUG: unable to handle kernel paging request' error at boot
when using the cht-bsw-rt5645 driver.
With this patch we also fix a wrong indexing in the driver where the
codec_name of the wrong dai_link is being overwritten.
Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/boards/cht_bsw_rt5645.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index 2d3afdd..a7b96a9 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -367,8 +367,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev) } card->dev = &pdev->dev; sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id); + /* set correct codec name */ - strcpy((char *)card->dai_link[2].codec_name, 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); + snd_soc_card_set_drvdata(card, drv); ret_val = devm_snd_soc_register_card(&pdev->dev, card); if (ret_val) { |