* [PATCH] ASoC: Intel: Fix check for pdata usage before dereference.
@ 2014-05-05 12:20 Liam Girdwood
2014-05-05 19:42 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Liam Girdwood @ 2014-05-05 12:20 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, alsa-devel
This patch fixes the following dereference check ordering.
sound/soc/intel/sst-haswell-pcm.c:749 hsw_pcm_probe() warn: variable dereferenced before check 'pdata' (see line 746)
git remote add asoc git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
git remote update asoc
git checkout 0b708c87f66a15190fb43661c2320fd48c4dc6c8
vim +/pdata +749 sound/soc/intel/sst-haswell-pcm.c
a4b12990 Mark Brown 2014-03-12 740 };
a4b12990 Mark Brown 2014-03-12 741
a4b12990 Mark Brown 2014-03-12 742 static int hsw_pcm_probe(struct snd_soc_platform *platform)
a4b12990 Mark Brown 2014-03-12 743 {
a4b12990 Mark Brown 2014-03-12 744 struct sst_pdata *pdata = dev_get_platdata(platform->dev);
a4b12990 Mark Brown 2014-03-12 745 struct hsw_priv_data *priv_data;
0b708c87 Liam Girdwood 2014-05-02 @746 struct device *dma_dev = pdata->dma_dev;
0b708c87 Liam Girdwood 2014-05-02 747 int i, ret = 0;
a4b12990 Mark Brown 2014-03-12 748
a4b12990 Mark Brown 2014-03-12 @749 if (!pdata)
a4b12990 Mark Brown 2014-03-12 750 return -ENODEV;
a4b12990 Mark Brown 2014-03-12 751
a4b12990 Mark Brown 2014-03-12 752 priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data), GFP_KERNEL);
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
sound/soc/intel/sst-haswell-pcm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c
index 8c6bd33..9d5f64a 100644
--- a/sound/soc/intel/sst-haswell-pcm.c
+++ b/sound/soc/intel/sst-haswell-pcm.c
@@ -772,12 +772,14 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform)
{
struct sst_pdata *pdata = dev_get_platdata(platform->dev);
struct hsw_priv_data *priv_data;
- struct device *dma_dev = pdata->dma_dev;
+ struct device *dma_dev;
int i, ret = 0;
if (!pdata)
return -ENODEV;
+ dma_dev = pdata->dma_dev;
+
priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data), GFP_KERNEL);
priv_data->hsw = pdata->dsp;
snd_soc_platform_set_drvdata(platform, priv_data);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: Intel: Fix check for pdata usage before dereference.
2014-05-05 12:20 [PATCH] ASoC: Intel: Fix check for pdata usage before dereference Liam Girdwood
@ 2014-05-05 19:42 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-05-05 19:42 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 272 bytes --]
On Mon, May 05, 2014 at 01:20:23PM +0100, Liam Girdwood wrote:
> This patch fixes the following dereference check ordering.
>
> sound/soc/intel/sst-haswell-pcm.c:749 hsw_pcm_probe() warn: variable dereferenced before check 'pdata' (see line 746)
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-06 0:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 12:20 [PATCH] ASoC: Intel: Fix check for pdata usage before dereference Liam Girdwood
2014-05-05 19:42 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox