From: Hendrik Brueckner Date: Wed, 31 May 2017 13:22:19 +0000 (+0200) Subject: s390/cpum_sf: do not register PMU if no sampling mode is authorized X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9232c3c741200167e44ae9d0e434092657ab4534;p=linux.git s390/cpum_sf: do not register PMU if no sampling mode is authorized Previously, the cpum_sf PMU was registered even if there is no sampling mode authorized. Add a check and register cpum_sf only at least one sampling mode is authorized. Signed-off-by: Hendrik Brueckner Signed-off-by: Martin Schwidefsky --- diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 4d8ddd8bd9bef..7e9b9e6ee8217 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1938,6 +1938,9 @@ static int __init init_cpum_sampling_pmu(void) return -ENODEV; } + if (!si.as && !si.ad) + return -ENODEV; + if (si.bsdes != sizeof(struct hws_basic_entry)) { pr_cpumsf_err(RS_INIT_FAILURE_BSDES); return -EINVAL;