Skip to content

Commit d7dbe5f

Browse files
nathanchancegregkh
authored andcommitted
s390/cpum_cf: Fix uninitialized warning after backport of ce97123
Upstream commit ce97123 ("s390/cpum_cf: Deny all sampling events by counter PMU"), backported to 6.6 as commit d660c8d ("s390/cpum_cf: Deny all sampling events by counter PMU"), implicitly depends on the unconditional initialization of err to -ENOENT added by upstream commit aa1ac98 ("s390/cpumf: Fix double free on error in cpumf_pmu_event_init()"). The latter change is missing from 6.6, resulting in an instance of -Wuninitialized, which is fairly obvious from looking at the actual diff. arch/s390/kernel/perf_cpum_cf.c:858:10: warning: variable 'err' is uninitialized when used here [-Wuninitialized] 858 | return err; | ^~~ Commit aa1ac98 ("s390/cpumf: Fix double free on error in cpumf_pmu_event_init()") depends on commit c70ca29 ("perf/core: Simplify the perf_event_alloc() error path"), which is a part of a much larger series unsuitable for stable. Extract the unconditional initialization of err to -ENOENT from commit aa1ac98 ("s390/cpumf: Fix double free on error in cpumf_pmu_event_init()") and apply it to 6.6 as a standalone change to resolve the warning. Fixes: d660c8d ("s390/cpum_cf: Deny all sampling events by counter PMU") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent af3d855 commit d7dbe5f

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

arch/s390/kernel/perf_cpum_cf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,15 +552,13 @@ static int cpumf_pmu_event_type(struct perf_event *event)
552552
static int cpumf_pmu_event_init(struct perf_event *event)
553553
{
554554
unsigned int type = event->attr.type;
555-
int err;
555+
int err = -ENOENT;
556556

557557
if (type == PERF_TYPE_HARDWARE || type == PERF_TYPE_RAW)
558558
err = __hw_perf_event_init(event, type);
559559
else if (event->pmu->type == type)
560560
/* Registered as unknown PMU */
561561
err = __hw_perf_event_init(event, cpumf_pmu_event_type(event));
562-
else
563-
return -ENOENT;
564562

565563
if (unlikely(err) && event->destroy)
566564
event->destroy(event);

0 commit comments

Comments
 (0)