[alsa-devel] [PATCH] ASoC: simple-card: fix a bug where cinfo will be NULL before using it
![](https://secure.gravatar.com/avatar/a228098402d7790b51abfe7e0c45a748.jpg?s=120&d=mm&r=g)
If the dt is not used, the cinfo will be always NULL before using it.
Signed-off-by: Xiubo Li Li.Xiubo@freescale.com --- sound/soc/generic/simple-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index c67d2db..51a4784 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -225,8 +225,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev) } } } else { - cinfo->snd_card.dev = &pdev->dev; cinfo = pdev->dev.platform_data; + cinfo->snd_card.dev = &pdev->dev; }
if (!cinfo) {
![](https://secure.gravatar.com/avatar/d930951cb00393ecf9c3db3a56d78fa9.jpg?s=120&d=mm&r=g)
On Thu, Jan 09, 2014 at 05:19:08PM +0800, Xiubo Li wrote:
} else {
cinfo = pdev->dev.platform_data;cinfo->snd_card.dev = &pdev->dev;
}cinfo->snd_card.dev = &pdev->dev;
I've applied this since not crashing is good but it's a bug to be writing to the platform data at all, it should be constant. If it needs to be written to a copy should be being used.
participants (2)
-
Mark Brown
-
Xiubo Li