Re: [PATCH 1/2] [CPUFREQ] powernow-k8: Don't notify of successfultransition if we failed.

From: Konrad Rzeszutek Wilk
Date: Thu Jun 16 2011 - 10:25:34 EST


On Wed, Jun 15, 2011 at 06:26:08PM -0400, Konrad Rzeszutek Wilk wrote:
> > > @@ -1112,6 +1114,9 @@ static int transition_frequency_pstate(struct powernow_k8_data *data,
> > > }
> > >
> > > res = transition_pstate(data, pstate);
> > > + if (res)
> > > + return res;
> >
> > That's wrong because transition_pstate() returns 0 unconditionally
> > (at least it does so on 3.0-rc3). But this change accidentally fixes
> > a different bug because res is used uninitialized, containing stack
> > garbage otherwise.
> >
> > A proper fix should be to check against data->max_hw_pstate and
> > check whether the entry is not CPUFREQ_ENTRY_INVALID (look at
> > fill_powernow_table_pstate() for example).
>
> Aha! I can respin a patch for that tomorrow.

I divided it in two patches - so that the Reported/Tested-by tag is on
the translate_vid patch with its full glory of explanation. The
pstate checking is removed.

Will post the other patch under a different subject.