summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-02-15 23:28:29 +0400
committerMark Brown <broonie@linaro.org>2014-02-16 04:36:40 +0400
commit9febd494d15c4a351e9c9cae7184643144eea892 (patch)
treef01b0ed7b6f3979b6b0cb5151c7cbc119ba51bee
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
downloadlinux-9febd494d15c4a351e9c9cae7184643144eea892.tar.xz
ASoC: txx9aclc_ac97: Fix kernel crash on probe
This patch fixes a crash caused by commit 3bed3344c826 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated. Fixes: 3bed3344c826 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()) Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
-rw-r--r--sound/soc/txx9/txx9aclc-ac97.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c
index e0305a148568..9edd68db9f48 100644
--- a/sound/soc/txx9/txx9aclc-ac97.c
+++ b/sound/soc/txx9/txx9aclc-ac97.c
@@ -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) &&