perf_events: fix issue where we dereference a pointer before NULL check.
perf_events: fix issue where we dereference a pointer before NULL check.

Fix suggested by Will Cohen, based on a coverity report.

arm-hpc/papi,arm-hpc/papi,arm-hpc/papi,pyrovski/papi,arm-hpc/papi,pyrovski/papi,pyrovski/papi,arm-hpc/papi,arm-hpc/papi,pyrovski/papi,pyrovski/papi,arm-hpc/papi,pyrovski/papi,pyrovski/papi,pyrovski/papi