aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-01-14 12:35:32 +0800
committerJon Medhurst <tixy@linaro.org>2015-03-27 15:55:23 +0000
commitd64ec740ddba9a21ec7080739d18b6ad0f29bf47 (patch)
tree5e87c45c9f5592b0524bed2a5e33c1d5797f66a4 /sound
parent30da281ac10a6abd4ff3e1e389b0b83c4cb8b238 (diff)
ASoC: simple-card: fix one bug to writing to the platform data
It's a bug that writing to the platform data directly, for it should be constant. So just copy it before writing. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> (cherry picked from commit ca919fe4b972b9428ab42bead11b04a4ebf0f632) Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 79dcac778d67..2a1b1b5b5221 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -9,9 +9,10 @@
* published by the Free Software Foundation.
*/
#include <linux/clk.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
-#include <linux/module.h>
+#include <linux/string.h>
#include <sound/simple_card.h>
static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
@@ -193,36 +194,37 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct device_node *of_cpu, *of_codec, *of_platform;
struct device *dev = &pdev->dev;
+ int ret;
cinfo = NULL;
of_cpu = NULL;
of_codec = NULL;
of_platform = NULL;
+
+ cinfo = devm_kzalloc(dev, sizeof(*cinfo), GFP_KERNEL);
+ if (!cinfo)
+ return -ENOMEM;
+
if (np && of_device_is_available(np)) {
- cinfo = devm_kzalloc(dev, sizeof(*cinfo), GFP_KERNEL);
- if (cinfo) {
- int ret;
- cinfo->snd_card.dev = &pdev->dev;
- ret = asoc_simple_card_parse_of(np, cinfo, dev,
- &of_cpu,
- &of_codec,
- &of_platform);
- if (ret < 0) {
- if (ret != -EPROBE_DEFER)
- dev_err(dev, "parse error %d\n", ret);
- return ret;
- }
- } else {
- return -ENOMEM;
+ cinfo->snd_card.dev = dev;
+
+ ret = asoc_simple_card_parse_of(np, cinfo, dev,
+ &of_cpu,
+ &of_codec,
+ &of_platform);
+ if (ret < 0) {
+ if (ret != -EPROBE_DEFER)
+ dev_err(dev, "parse error %d\n", ret);
+ return ret;
}
} else {
- cinfo = pdev->dev.platform_data;
- if (!cinfo) {
+ if (!dev->platform_data) {
dev_err(dev, "no info for asoc-simple-card\n");
return -EINVAL;
}
- cinfo->snd_card.dev = &pdev->dev;
+ memcpy(cinfo, dev->platform_data, sizeof(*cinfo));
+ cinfo->snd_card.dev = dev;
}
if (!cinfo->name ||