On Wed, 2015-02-25 at 16:42 +0600, Boris Egorov wrote: > Error: if thread_info.state is DRAINED, it cannot be equal to RUNNING. > So, part of condition is redundant or wrong. Original code looks > different from this (see commit 045c1d602dcba578), so it is most likely > wrong. We need to set thread_info.drained to 1 only if thread_info.state > is not DRAINED or RUNNING. > > Issue detected by PVS Studio and Cppcheck. > > Signed-off-by: Boris Egorov <egorov at linux.com> > --- > src/pulsecore/sink-input.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c > index d95a93e..29beca6 100644 > --- a/src/pulsecore/sink-input.c > +++ b/src/pulsecore/sink-input.c > @@ -1876,7 +1876,7 @@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state > return; > > if ((state == PA_SINK_INPUT_DRAINED || state == PA_SINK_INPUT_RUNNING) && > - !(i->thread_info.state == PA_SINK_INPUT_DRAINED || i->thread_info.state != PA_SINK_INPUT_RUNNING)) > + !(i->thread_info.state == PA_SINK_INPUT_DRAINED || i->thread_info.state == PA_SINK_INPUT_RUNNING)) > pa_atomic_store(&i->thread_info.drained, 1); > > corking = state == PA_SINK_INPUT_CORKED && i->thread_info.state == PA_SINK_INPUT_RUNNING; This fix looks correct to me, but I'm wondering why it's never triggered a bug (or whether we can fashion a test case that should trigger it). -- Arun