Skip to contentSkip to conversation

ASoC: Intel: Add Skylake HDA platform driver

DISCUSSION Dan Carpenter 2 participants 2 messages Oct 21, 2015 – Oct 30, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello Jeeja KP,

This is a semi-automatic email about new static checker warnings.

The patch a40e693c7f5e: "ASoC: Intel: Add Skylake HDA platform driver" from Jul 9, 2015, leads to the following Smatch complaint:

sound/soc/intel/skylake/skl-pcm.c:802 skl_get_position()

	 warn: variable dereferenced before check 'substream->runtime' (see line 792)

sound/soc/intel/skylake/skl-pcm.c
791 struct snd_pcm_substream *substream = hstr->substream;

   792		struct hdac_ext_bus *ebus = get_bus_ctx(substream);
                                            ^^^^^^^^^^^^^^^^^^^^^^

Dereference inside function.

793 unsigned int pos;
794 int delay;
795
796 /* use the position buffer as default */
797 pos = snd_hdac_stream_get_pos_posbuf(hdac_stream(hstream));
798
799 if (pos >= hdac_stream(hstream)->bufsize)
800 pos = 0;
801

   802		if (substream->runtime) {
                    ^^^^^^^^^^^^^^^^^^

Checked too late.

803 delay = skl_get_delay_from_lpib(ebus, hstream, pos)
804 + codec_delay;

regards,
dan carpenter

A message that is not in the archive (sent off-list or not yet received): FE1218A4CE6FF04999892577E0FB3E832B42BFB8@BGSMSX102.gar.corp.intel.com

#2 lore raw
Quoted 17 lines
Quoted 17 lines

Hello Jeeja KP,

This is a semi-automatic email about new static checker warnings.

The patch a40e693c7f5e: "ASoC: Intel: Add Skylake HDA platform driver" from Jul 9, 2015, leads to the following Smatch complaint:

sound/soc/intel/skylake/skl-pcm.c:802 skl_get_position()

	 warn: variable dereferenced before check 'substream->runtime' (see

line 792)

sound/soc/intel/skylake/skl-pcm.c

   791		struct snd_pcm_substream *substream = hstr->substream;
   792		struct hdac_ext_bus *ebus = get_bus_ctx(substream);
                                            ^^^^^^^^^^^^^^^^^^^^^^ Dereference inside

function.

Quoted 13 lines
Quoted 12 lines
   793		unsigned int pos;
   794		int delay;
   795
   796		/* use the position buffer as default */
   797		pos =
snd_hdac_stream_get_pos_posbuf(hdac_stream(hstream));
   798
   799		if (pos >= hdac_stream(hstream)->bufsize)
   800			pos = 0;
   801
   802		if (substream->runtime) {
                    ^^^^^^^^^^^^^^^^^^
Quoted 1 line

Checked too late.

Right, will move ebus init here.

Thanks for reporting this

Quoted 6 lines
Quoted 6 lines
   803			delay = skl_get_delay_from_lpib(ebus, hstream, pos)
   804							 + codec_delay;

regards,
dan carpenter

Signature · 1 line
~Vinod