tools/power/x86/intel-speed-select: Fix warning for perf_cap.cpu

Bugzilla: https://bugzilla.redhat.com/2154079

commit 9230a2ac2b47c443e3f0be512d439e811356fab2
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Wed May 11 10:12:08 2022 -0700

    tools/power/x86/intel-speed-select: Fix warning for perf_cap.cpu

    Initialize perf_cap struct to avoid warning:

      CC      hfi-events.o
    In function ‘process_hfi_event’,
        inlined from ‘handle_event’ at hfi-events.c:220:5:
    hfi-events.c:184:9: warning: ‘perf_cap.cpu’ may be used
    uninitialized [-Wmaybe-uninitialized]
      184 |         process_level_change(perf_cap->cpu);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    hfi-events.c: In function ‘handle_event’:
    hfi-events.c:193:25: note: ‘perf_cap.cpu’ was declared here
      193 |         struct perf_cap perf_cap;
          |                         ^~~~~~~~

    Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Link: https://lore.kernel.org/r/20220511171208.211319-1-srinivas.pandruvada@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
This commit is contained in:
David Arcari 2023-05-24 15:21:54 -04:00
parent 6f5c5df34c
commit 6fe05ee6a5
1 changed files with 1 additions and 1 deletions

View File

@ -190,7 +190,7 @@ static int handle_event(struct nl_msg *n, void *arg)
struct genlmsghdr *genlhdr = genlmsg_hdr(nlh);
struct nlattr *attrs[THERMAL_GENL_ATTR_MAX + 1];
int ret;
struct perf_cap perf_cap;
struct perf_cap perf_cap = {0};
ret = genlmsg_parse(nlh, 0, attrs, THERMAL_GENL_ATTR_MAX, NULL);