Skip to contentSkip to conversation

ASoC: txx9aclc_ac97: Fix kernel crash on probe

PATCH Applied Alexander Shiyan 2 participants 5 messages Feb 15, 2014 – Feb 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: txx9aclc_ac97: Fix kernel crash on probe

This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.

---
 sound/soc/txx9/txx9aclc-ac97.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/txx9/txx9aclc-ac97.c +5 -3
index e0305a1..9edd68d 100644
@@ -183,14 +183,16 @@ static int txx9aclc_ac97_dev_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
+
+	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
+	if (!drvdata)
+		return -ENOMEM;
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	drvdata->base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(drvdata->base))
 		return PTR_ERR(drvdata->base);
 
-	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
-	if (!drvdata)
-		return -ENOMEM;
 	platform_set_drvdata(pdev, drvdata);
 	drvdata->physbase = r->start;
 	if (sizeof(drvdata->physbase) > sizeof(r->start) &&
Signature · 1 line
1.8.3.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Alexander Shiyan

This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.

Applied, thanks.

maintainer
#2 lore raw
In reply to Alexander Shiyan
Quoted 4 lines · Alexander Shiyan

This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.

I don't know where you got that hash from by the way, that commit isn't present in mainline?

#3 lore raw

Воскресенье, 16 февраля 2014, 8:38 +08:00 от Mark Brown <[email protected]>:

Quoted 8 lines · Alexander Shiyan
Quoted 4 lines

This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.

I don't know where you got that hash from by the way, that commit isn't present in mainline?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/sound/soc/txx9/txx9aclc-ac97.c?id=3bed3344c82623f6a37f3032e307d9af5b2d7519

---
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#4 lore raw
Quoted 8 lines · Alexander Shiyan

Воскресенье, 16 февраля 2014, 8:38 +08:00 от Mark Brown <[email protected]>:

Quoted 5 lines · Alexander Shiyan
Quoted 1 line

This patch fixes a crash caused by commit af5b2d7519

I don't know where you got that hash from by the way, that commit isn't present in mainline?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/sound/soc/txx9/txx9aclc-ac97.c?id=3bed3344c82623f6a37f3032e307d9af5b2d7519

A shortened commit ID is the *start* of the ID, not the end. Try running 'git show af5b2d7519'.