alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Re: ASoC: Intel: Add Skylake HDA platform driver
@ 2015-10-21 20:53 Dan Carpenter
       [not found] ` <FE1218A4CE6FF04999892577E0FB3E832B42BFB8@BGSMSX102.gar.corp.intel.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-21 20:53 UTC (permalink / raw)
  To: jeeja.kp; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ASoC: Intel: Add Skylake HDA platform driver
       [not found] ` <FE1218A4CE6FF04999892577E0FB3E832B42BFB8@BGSMSX102.gar.corp.intel.com>
@ 2015-10-30 12:10   ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2015-10-30 12:10 UTC (permalink / raw)
  To: Kp, Jeeja, dan.carpenter; +Cc: alsa-devel

> > 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.

Right, will move ebus init here.

Thanks for reporting this

> > 
> >    803			delay = skl_get_delay_from_lpib(ebus, hstream, pos)
> >    804							 + codec_delay;
> > 
> > regards,
> > dan carpenter

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-30 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 20:53 ASoC: Intel: Add Skylake HDA platform driver Dan Carpenter
     [not found] ` <FE1218A4CE6FF04999892577E0FB3E832B42BFB8@BGSMSX102.gar.corp.intel.com>
2015-10-30 12:10   ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).