summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2013-07-30 14:12:20 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 13:38:01 -0700
commit6d4c76136ff0aa5e6657e691ff942808f24456da (patch)
tree3f25bc3f76b0d3d9e84c1f115f485a47bdab9ddb /sound
parentda646e63531f5097386620df6e53ae214d7ff0dd (diff)
asoc: tegra: fix NULL pointer dereference
- fix Coverity issues - fix dereference of null pointer Coverity id : 23721 Coverity id : 23735 Bug 1329327 Change-Id: I877959ab5446e09648a52fd18fd4a219c3f01e7e Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/255453 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com> Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_dmic.c5
-rw-r--r--sound/soc/tegra/tegra_wm8903.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/sound/soc/tegra/tegra_dmic.c b/sound/soc/tegra/tegra_dmic.c
index 44324a23ac47..abeaee5ff7bd 100644
--- a/sound/soc/tegra/tegra_dmic.c
+++ b/sound/soc/tegra/tegra_dmic.c
@@ -654,7 +654,10 @@ static int __devexit asoc_dmic_remove(struct platform_device *pdev)
snd_soc_unregister_dai(&pdev->dev);
iounmap(dmic->io_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(res->start, resource_size(res));
+ if (res)
+ release_mem_region(res->start, resource_size(res));
+ else
+ dev_err(&pdev->dev, "failed to get memory resource\n");
if (dmic->parent)
clk_put(dmic->parent);
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 5b5aad6afc76..113d8fdc40f6 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -821,6 +821,15 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev)
if (pdev->dev.platform_data) {
memcpy(pdata, card->dev->platform_data, sizeof(*pdata));
} else if (np) {
+ pdata = devm_kzalloc(&pdev->dev,
+ sizeof(struct tegra_asoc_platform_data), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(&pdev->dev,
+ "no memory for tegra_asoc_platform_data\n");
+ ret = -ENOMEM;
+ goto err;
+ }
+
pdata->gpio_spkr_en = of_get_named_gpio(np,
"nvidia,spkr-en-gpios", 0);
if (pdata->gpio_spkr_en == -EPROBE_DEFER)