lkml.org 
[lkml]   [2014]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] ASoC: dwc: Don't allow negative use counts
On Thu, Dec 04, 2014 at 09:00:35AM +0000, Andrew Jackson wrote:
> On 12/03/14 17:25, Mark Brown wrote:
> > On Wed, Dec 03, 2014 at 04:38:55PM +0000, Andrew Jackson wrote:

> >> case SNDRV_PCM_TRIGGER_STOP:
> >> case SNDRV_PCM_TRIGGER_SUSPEND:
> >> case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> >> - dev->active--;
> >> + if (dev->active > 0)
> >> + dev->active--;

> > How is this triggering - this sounds like you're papering over some
> > other bug somewhere?

> When I looked at the code paths I couldn't convince myself that STOP
> wouldn't be called more than once. Then actuve would be negative and
> the device might not be restartable. I didn't have a problem per se,
> it was just that it seemed to be something of a loophole.

If you're just adding the check on the off chance that it might fire you
need to add a warning message as well - what your change does is make
the code look like it's supposed to have broken reference counting since
it has a check to silently fix up and ignore problems.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-12-04 12:21    [W:0.041 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site