linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
@ 2012-09-25 10:44 Stephane Eranian
  2012-09-25 11:20 ` Peter Zijlstra
  2012-09-27  1:33 ` Yan, Zheng
  0 siblings, 2 replies; 4+ messages in thread
From: Stephane Eranian @ 2012-09-25 10:44 UTC (permalink / raw)
  To: LKML; +Cc: Yan, Zheng, ak, Peter Zijlstra, mingo

Hi,

I don't understand why the local variable box needs to
be declared static here:

static struct intel_uncore_box *
uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
{
        static struct intel_uncore_box *box;

        box = *per_cpu_ptr(pmu->box, cpu);
        if (box)
                return box;
        ....
}

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

* Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
  2012-09-25 10:44 [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo Stephane Eranian
@ 2012-09-25 11:20 ` Peter Zijlstra
  2012-09-25 11:57   ` Ingo Molnar
  2012-09-27  1:33 ` Yan, Zheng
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2012-09-25 11:20 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: LKML, Yan, Zheng, ak, mingo

On Tue, 2012-09-25 at 12:44 +0200, Stephane Eranian wrote:
> Hi,
> 
> I don't understand why the local variable box needs to
> be declared static here:
> 
> static struct intel_uncore_box *
> uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
> {
>         static struct intel_uncore_box *box;
> 
>         box = *per_cpu_ptr(pmu->box, cpu);
>         if (box)
>                 return box;
>         ....
> }

Uhmm.. me neither.. that looks like a bug indeed.

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

* Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
  2012-09-25 11:20 ` Peter Zijlstra
@ 2012-09-25 11:57   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2012-09-25 11:57 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Stephane Eranian, LKML, Yan, Zheng, ak, mingo


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, 2012-09-25 at 12:44 +0200, Stephane Eranian wrote:
> > Hi,
> > 
> > I don't understand why the local variable box needs to
> > be declared static here:
> > 
> > static struct intel_uncore_box *
> > uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
> > {
> >         static struct intel_uncore_box *box;
> > 
> >         box = *per_cpu_ptr(pmu->box, cpu);
> >         if (box)
> >                 return box;
> >         ....
> > }
> 
> Uhmm.. me neither.. that looks like a bug indeed.

the compiler (or Sparse) should refuse function local statics 
really.

Thanks,

	Ingo

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

* Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
  2012-09-25 10:44 [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo Stephane Eranian
  2012-09-25 11:20 ` Peter Zijlstra
@ 2012-09-27  1:33 ` Yan, Zheng
  1 sibling, 0 replies; 4+ messages in thread
From: Yan, Zheng @ 2012-09-27  1:33 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: LKML, ak, Peter Zijlstra, mingo

On 09/25/2012 06:44 PM, Stephane Eranian wrote:
> Hi,
> 
> I don't understand why the local variable box needs to
> be declared static here:
> 
> static struct intel_uncore_box *
> uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
> {
>         static struct intel_uncore_box *box;
> 
>         box = *per_cpu_ptr(pmu->box, cpu);
>         if (box)
>                 return box;
>         ....
> }
> 

My fault, sorry

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

end of thread, other threads:[~2012-09-27  1:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-25 10:44 [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo Stephane Eranian
2012-09-25 11:20 ` Peter Zijlstra
2012-09-25 11:57   ` Ingo Molnar
2012-09-27  1:33 ` Yan, Zheng

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