File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -790,26 +790,23 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
790
790
if (!pmuv3_implemented (kvm_arm_pmu_get_pmuver_limit ()))
791
791
return ;
792
792
793
- mutex_lock (& arm_pmus_lock );
793
+ guard ( mutex ) (& arm_pmus_lock );
794
794
795
795
entry = kmalloc (sizeof (* entry ), GFP_KERNEL );
796
796
if (!entry )
797
- goto out_unlock ;
797
+ return ;
798
798
799
799
entry -> arm_pmu = pmu ;
800
800
list_add_tail (& entry -> entry , & arm_pmus );
801
-
802
- out_unlock :
803
- mutex_unlock (& arm_pmus_lock );
804
801
}
805
802
806
803
static struct arm_pmu * kvm_pmu_probe_armpmu (void )
807
804
{
808
- struct arm_pmu * tmp , * pmu = NULL ;
809
805
struct arm_pmu_entry * entry ;
806
+ struct arm_pmu * pmu ;
810
807
int cpu ;
811
808
812
- mutex_lock (& arm_pmus_lock );
809
+ guard ( mutex ) (& arm_pmus_lock );
813
810
814
811
/*
815
812
* It is safe to use a stale cpu to iterate the list of PMUs so long as
@@ -830,17 +827,13 @@ static struct arm_pmu *kvm_pmu_probe_armpmu(void)
830
827
*/
831
828
cpu = raw_smp_processor_id ();
832
829
list_for_each_entry (entry , & arm_pmus , entry ) {
833
- tmp = entry -> arm_pmu ;
830
+ pmu = entry -> arm_pmu ;
834
831
835
- if (cpumask_test_cpu (cpu , & tmp -> supported_cpus )) {
836
- pmu = tmp ;
837
- break ;
838
- }
832
+ if (cpumask_test_cpu (cpu , & pmu -> supported_cpus ))
833
+ return pmu ;
839
834
}
840
835
841
- mutex_unlock (& arm_pmus_lock );
842
-
843
- return pmu ;
836
+ return NULL ;
844
837
}
845
838
846
839
static u64 __compute_pmceid (struct arm_pmu * pmu , bool pmceid1 )
You can’t perform that action at this time.
0 commit comments