summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/skylake/skl-pcm.c
diff options
context:
space:
mode:
authorVinod Koul2015-10-30 16:04:20 +0100
committerMark Brown2015-11-16 11:08:09 +0100
commitc7b2a44410a1029f1cee4ad0b86588c9a0f83a6c (patch)
treec8a407b5a531ab0b8a07506d7fa38e0bc3454686 /sound/soc/intel/skylake/skl-pcm.c
parentASoC: Intel: Skylake: Fix to cleanup if skl_sst_dsp_init fails (diff)
downloadkernel-qcow2-linux-c7b2a44410a1029f1cee4ad0b86588c9a0f83a6c.tar.gz
kernel-qcow2-linux-c7b2a44410a1029f1cee4ad0b86588c9a0f83a6c.tar.xz
kernel-qcow2-linux-c7b2a44410a1029f1cee4ad0b86588c9a0f83a6c.zip
ASoC: Intel: Skylake: Fix substream dereference before check
Smatch warns that we dereferenced substream before check, so fix this by initializing ebus after the check sound/soc/intel/skylake/skl-pcm.c:802 skl_get_position() warn: variable dereferenced before check 'substream->runtime' Reported by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/skylake/skl-pcm.c')
-rw-r--r--sound/soc/intel/skylake/skl-pcm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 2517ec576ffc..e652d58bd9a9 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -807,7 +807,7 @@ static unsigned int skl_get_position(struct hdac_ext_stream *hstream,
{
struct hdac_stream *hstr = hdac_stream(hstream);
struct snd_pcm_substream *substream = hstr->substream;
- struct hdac_ext_bus *ebus = get_bus_ctx(substream);
+ struct hdac_ext_bus *ebus;
unsigned int pos;
int delay;
@@ -818,6 +818,7 @@ static unsigned int skl_get_position(struct hdac_ext_stream *hstream,
pos = 0;
if (substream->runtime) {
+ ebus = get_bus_ctx(substream);
delay = skl_get_delay_from_lpib(ebus, hstream, pos)
+ codec_delay;
substream->runtime->delay += delay;