[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1603263782-8711-1-git-send-email-bodefang@126.com>
Date: Wed, 21 Oct 2020 15:03:02 +0800
From: Defang Bo <bodefang@....com>
To: perex@...ex.cz
Cc: tiwai@...e.com, lgirdwood@...il.com,
Vishnuvardhanrao.Ravulapati@....com, akshu.agrawal@....com,
weiyongjun1@...wei.com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, Defang Bo <bodefang@....com>
Subject: [PATCH v2] ASoC: amd: move the call to devm_kzalloc below platform_get_resource()
Just as the commit <4cb79ef9c6c4>("ASoC: amd: Fix potential NULL pointer dereference"),it makes no sense to allocate any resources if platform_get_resource fails,so move the call to devm_kzalloc() below the mentioned code.
Signed-off-by: Defang Bo <bodefang@....com>
---
sound/soc/amd/raven/acp3x-i2s.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c
index c9c69eb..04ec603 100644
--- a/sound/soc/amd/raven/acp3x-i2s.c
+++ b/sound/soc/amd/raven/acp3x-i2s.c
@@ -307,9 +307,11 @@ static int acp3x_dai_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n");
return -ENOMEM;
}
+
adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data), GFP_KERNEL);
if (!adata)
return -ENOMEM;
+
adata->acp3x_base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!adata->acp3x_base)
--
1.9.1
Powered by blists - more mailing lists