Skip to contentSkip to conversation

ASoC: simple-card: fix a bug where cinfo will be NULL before using it

PATCH In review Xiubo Li 2 participants 2 messages Jan 9, 2014

Subsystems (3)
lore
Share & tools
lore

Xiubo Li

author
#0 lore raw

PATCH 1/1 ASoC: simple-card: fix a bug where cinfo will be NULL before using it

If the dt is not used, the cinfo will be always NULL before using it.

---
 sound/soc/generic/simple-card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/generic/simple-card.c +1 -1
index c67d2db..51a4784 100644
@@ -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) {
Signature · 1 line
1.8.4
maintainer
#1 lore raw

sound/soc/generic/simple-card.c static int asoc_simple_card_probe(struct platform_device *pdev) · line 230

Quoted 5 lines · Xiubo Li
sound/soc/generic/simple-card.c +1 -1
 	} else {
-		cinfo->snd_card.dev = &pdev->dev;
 		cinfo = pdev->dev.platform_data;
+		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.