Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca919fe4 authored by Xiubo Li's avatar Xiubo Li Committed by Mark Brown
Browse files

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: default avatarXiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent ba194a4d
Loading
Loading
Loading
Loading
+21 −19
Original line number Original line Diff line number Diff line
@@ -9,9 +9,10 @@
 * published by the Free Software Foundation.
 * published by the Free Software Foundation.
 */
 */
#include <linux/clk.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/string.h>
#include <sound/simple_card.h>
#include <sound/simple_card.h>


static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
@@ -190,16 +191,20 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
	struct device_node *np = pdev->dev.of_node;
	struct device_node *np = pdev->dev.of_node;
	struct device_node *of_cpu, *of_codec, *of_platform;
	struct device_node *of_cpu, *of_codec, *of_platform;
	struct device *dev = &pdev->dev;
	struct device *dev = &pdev->dev;
	int ret;


	cinfo		= NULL;
	cinfo		= NULL;
	of_cpu		= NULL;
	of_cpu		= NULL;
	of_codec	= NULL;
	of_codec	= NULL;
	of_platform	= NULL;
	of_platform	= NULL;
	if (np && of_device_is_available(np)) {

	cinfo = devm_kzalloc(dev, sizeof(*cinfo), GFP_KERNEL);
	cinfo = devm_kzalloc(dev, sizeof(*cinfo), GFP_KERNEL);
		if (cinfo) {
	if (!cinfo)
			int ret;
		return -ENOMEM;
			cinfo->snd_card.dev = &pdev->dev;

	if (np && of_device_is_available(np)) {
		cinfo->snd_card.dev = dev;

		ret = asoc_simple_card_parse_of(np, cinfo, dev,
		ret = asoc_simple_card_parse_of(np, cinfo, dev,
						&of_cpu,
						&of_cpu,
						&of_codec,
						&of_codec,
@@ -210,16 +215,13 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
			return ret;
			return ret;
		}
		}
	} else {
	} else {
			return -ENOMEM;
		if (!dev->platform_data) {
		}
	} else {
		cinfo = pdev->dev.platform_data;
		if (!cinfo) {
			dev_err(dev, "no info for asoc-simple-card\n");
			dev_err(dev, "no info for asoc-simple-card\n");
			return -EINVAL;
			return -EINVAL;
		}
		}


		cinfo->snd_card.dev = &pdev->dev;
		memcpy(cinfo, dev->platform_data, sizeof(*cinfo));
		cinfo->snd_card.dev = dev;
	}
	}


	if (!cinfo->name	||
	if (!cinfo->name	||