Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
* Peter Zijlstra 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
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; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
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; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
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. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BUG] perf/x86: Intel uncore_pmu_to_box() local variable typo
* Peter Zijlstra pet...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/