Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5969827iob; Tue, 10 May 2022 07:40:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAOiswuMjw5f9/scEwTczxu1g/FY7BTacGd2QB3+4B1Wqx/P9+RsRmGYnfxPM7R38VRmrf X-Received: by 2002:a05:6402:1d4c:b0:427:d1f5:3a41 with SMTP id dz12-20020a0564021d4c00b00427d1f53a41mr23220228edb.218.1652193612598; Tue, 10 May 2022 07:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652193612; cv=none; d=google.com; s=arc-20160816; b=qR8aQ2QHL5aaMWfMyYQ/iCXY8N2d7F/jlyZman/474CfKfu3kI6JR7QsHdGS3nFFFu FelBqpoNXcaIWy9OPBEgDHi+16BhotODY6B2+JTobSWMq3fWVCo3aOu/xaRcothCxMDK XIdjXzUApqubLsQAI8LCybZQ8AJUWc6d22CtVEGqiwhJpcxQMTM03DWbQkmsHYA4Qwdy vZwaf0yw6MVdj3tXq/LHvxjI8/2PFYtasPLMPyFKvukbIJ+BJYEI8dwcGCPNPUN+M9jE 5kXsM2h406TAOzyHF7XcacdIXcceMu6z0UJ737l414JrRpD+7xd+1nMe5Xsn7NIow0zq s66g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0Hl5ghIdZdkU4k6qCypCHdoG8Gw3tiISfSLVKrcPEf8=; b=TZS/PzlhqB/4x4JHMS4lcSOphbqDiIn1QUOma3Jc2YM7vpnnsWZi/6AIKB2CF/Q2bw k6pB8glJKCRB7ndAln2eOsv0T00i3N7U6qbdeNGTwJ6zcL6YB1sGbQdJnrKsGvkvlZk0 Riio53iq2c+1DARdbJwQbJs+kkj0bzDr4HCEtpBg1wtpIR6fW2rdIb2hv6umeQYjNoI0 v09MK+pWtb7ZIF8I5Yq1TVOOqontse2W6Il6+1cpGn/6vg9xf7mO6/RVTe7r2XAmqwvb MeId1WsNCobbbHi/6WXInpdBiYixOPJu6QhZieJf6x2q3ClKQ1+g5XPUnmOtqxFOznQh l6Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="S2Vgv/3G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y25-20020a50eb99000000b0042374f2973bsi14263940edr.193.2022.05.10.07.39.39; Tue, 10 May 2022 07:40:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="S2Vgv/3G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239836AbiEJKb3 (ORCPT + 99 others); Tue, 10 May 2022 06:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239830AbiEJKb0 (ORCPT ); Tue, 10 May 2022 06:31:26 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26E5201337 for ; Tue, 10 May 2022 03:27:27 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24AA83di031186; Tue, 10 May 2022 03:27:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=0Hl5ghIdZdkU4k6qCypCHdoG8Gw3tiISfSLVKrcPEf8=; b=S2Vgv/3Gcx2Vzvy8+SAhnxk/3gmlqLl9jkK7IEjz4y8iMSxnrw0aO9dAc4Oo1gYiLiRS Oj/clCnWBhXheRKybjiOOxT4a85w0beNKcEGrb4O9AgWUpmPvhzmZgsFayHABvR3ZQi7 EvBwR82CdvAA+AJjv/NMUbOCWoFonMdg1+YpcUgAQQoUJxFTLiFLBUy0anKCFSMtWiNE JuKzf9UAbZNmFiB08Z0LKAhdx2Wduv1CA06WP3MppFLarjajxztV9vpBRG/vTTl/A7ZW ixNCXNxfoCBpg5aSU2Er8IsUfMGtTkDVwsWUtYGLHhIdezUV7NYqdgkmaofWXgEdOshU Vw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3fyp1br1ta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 10 May 2022 03:27:16 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 10 May 2022 03:27:15 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 10 May 2022 03:27:15 -0700 Received: from BG-SER530.marvell.com (BG-SER530.marvell.com [10.28.8.21]) by maili.marvell.com (Postfix) with ESMTP id E4D203F70A2; Tue, 10 May 2022 03:27:12 -0700 (PDT) From: Tanmay Jagdale To: , CC: , , , , , Tanmay Jagdale Subject: [PATCH] perf/marvell_cn10k: Fix tad_pmu_event_init() to check pmu type first Date: Tue, 10 May 2022 15:56:57 +0530 Message-ID: <20220510102657.487539-1-tanmay@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: jD1xn7UF0fqxBDyQrEgZmMuwCVBYL4gC X-Proofpoint-ORIG-GUID: jD1xn7UF0fqxBDyQrEgZmMuwCVBYL4gC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-10_01,2022-05-10_01,2022-02-23_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure to check the pmu type first and then check event->attr.disabled. Doing so would avoid reading the disabled attribute of an event that is not handled by TAD PMU. Signed-off-by: Tanmay Jagdale --- drivers/perf/marvell_cn10k_tad_pmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c index ee67305f822d..282d3a071a67 100644 --- a/drivers/perf/marvell_cn10k_tad_pmu.c +++ b/drivers/perf/marvell_cn10k_tad_pmu.c @@ -146,12 +146,12 @@ static int tad_pmu_event_init(struct perf_event *event) { struct tad_pmu *tad_pmu = to_tad_pmu(event->pmu); - if (!event->attr.disabled) - return -EINVAL; - if (event->attr.type != event->pmu->type) return -ENOENT; + if (!event->attr.disabled) + return -EINVAL; + if (event->state != PERF_EVENT_STATE_OFF) return -EINVAL; -- 2.25.1