Skip to content

Commit 60197a4

Browse files
Anshuman KhandualMarc Zyngier
authored andcommitted
KVM: arm64: pmu: Drop redundant check for non-NULL kvm_pmu_events
There is an allocated and valid struct kvm_pmu_events for each cpu on the system via DEFINE_PER_CPU(). Hence there cannot be a NULL pointer accessed via this_cpu_ptr() in the helper kvm_get_pmu_events(). Hence non-NULL check for pmu in such places are redundant and can be dropped. Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: James Morse <[email protected]> Cc: Suzuki K Poulose <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Anshuman Khandual <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 373beef commit 60197a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/kvm/pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr)
3939
{
4040
struct kvm_pmu_events *pmu = kvm_get_pmu_events();
4141

42-
if (!kvm_arm_support_pmu_v3() || !pmu || !kvm_pmu_switch_needed(attr))
42+
if (!kvm_arm_support_pmu_v3() || !kvm_pmu_switch_needed(attr))
4343
return;
4444

4545
if (!attr->exclude_host)
@@ -55,7 +55,7 @@ void kvm_clr_pmu_events(u32 clr)
5555
{
5656
struct kvm_pmu_events *pmu = kvm_get_pmu_events();
5757

58-
if (!kvm_arm_support_pmu_v3() || !pmu)
58+
if (!kvm_arm_support_pmu_v3())
5959
return;
6060

6161
pmu->events_host &= ~clr;

0 commit comments

Comments
 (0)