diff options
| -rw-r--r-- | arch/x86/events/intel/uncore.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 1c5390f1cf09..d45e06346f14 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c | |||
| @@ -822,7 +822,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) | |||
| 822 | pmus[i].type = type; | 822 | pmus[i].type = type; |
| 823 | pmus[i].boxes = kzalloc(size, GFP_KERNEL); | 823 | pmus[i].boxes = kzalloc(size, GFP_KERNEL); |
| 824 | if (!pmus[i].boxes) | 824 | if (!pmus[i].boxes) |
| 825 | return -ENOMEM; | 825 | goto err; |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | type->pmus = pmus; | 828 | type->pmus = pmus; |
| @@ -836,7 +836,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) | |||
| 836 | attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) + | 836 | attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) + |
| 837 | sizeof(*attr_group), GFP_KERNEL); | 837 | sizeof(*attr_group), GFP_KERNEL); |
| 838 | if (!attr_group) | 838 | if (!attr_group) |
| 839 | return -ENOMEM; | 839 | goto err; |
| 840 | 840 | ||
| 841 | attrs = (struct attribute **)(attr_group + 1); | 841 | attrs = (struct attribute **)(attr_group + 1); |
| 842 | attr_group->name = "events"; | 842 | attr_group->name = "events"; |
| @@ -849,7 +849,15 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) | |||
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | type->pmu_group = &uncore_pmu_attr_group; | 851 | type->pmu_group = &uncore_pmu_attr_group; |
| 852 | |||
| 852 | return 0; | 853 | return 0; |
| 854 | |||
| 855 | err: | ||
| 856 | for (i = 0; i < type->num_boxes; i++) | ||
| 857 | kfree(pmus[i].boxes); | ||
| 858 | kfree(pmus); | ||
| 859 | |||
| 860 | return -ENOMEM; | ||
| 853 | } | 861 | } |
| 854 | 862 | ||
| 855 | static int __init | 863 | static int __init |
