Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4808104iob; Mon, 9 May 2022 02:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSa40Uvu0yKwKFstckuoRXCKirgeVSck/uu4VJ7LnILnkLp8+/cxSjLbP9+K8QNaGN96+R X-Received: by 2002:a05:6e02:b26:b0:2cf:3424:cf7f with SMTP id e6-20020a056e020b2600b002cf3424cf7fmr6453967ilu.180.1652086950447; Mon, 09 May 2022 02:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652086950; cv=none; d=google.com; s=arc-20160816; b=hEkgoZ47h5aaip6GR8n1TUq4KGv/SBLzzOAzWqytiKS50XpVhhwS7z5Lzd0Pcl7oRX KMPWAA/jBYBoMfBxGEUPX9eSKT/ybByQjgcgHg4BP/GbSt383dE4OxcdHAt2HYy7KiLx VsLC85Fr500iJR7/sxQ0T4DzjvA3VaqM0MoxOMGmyAYU3TtyBpt+rhW4+TLbxURJa8kU iR3WqzCRicDZhL9+ux2OkRemgmCp3RgUR6jEuwaNQJxD08SyRE70ldlfB5KlN2Cs1pfj gvAiy0y7Zj3ZSGQGtaR6xBLRrTAzDg0IwEmR/V8LhMNSVGI/TLTLtV5R+XkI1g5mh6cH xgdQ== 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; bh=2BhNzQEBV+CF/pz+JGF8Nw/BhAFaCuRvIc/yH316rEc=; b=HNfmQjtuO6wy5qMj5ArqoziKdbRartkaolPHbsbIs8iz9RRXNWSFO4VCbsWDYNISWl vniRzvroG7rcdpGaEe1qcfr/mO2YNkjM+AI8XL6SI+3H9uwEReoe8WzPoDNwLbQpgH3F rtJ+UkguFa1JFpm+rg16MvwDEKZdPvPBwMmC9OGO9HSnuCljDh1F4J2KuE3WQ/RS56G1 ayJw+/Pw74JoVXow34GAVj9n8n+7BTAREFVC1x7Ciyog5fb6pezyXkFugyHvxPkANQ1P BpBVYEVlWYM9QYDtSlKTtyisHwNAearYlMzm7JFxzScTwHRRnvKKf7tIi16i4rYTCqde u0rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g11-20020a056e02198b00b002cf586a8784si10727117ilf.12.2022.05.09.02.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:02:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6966D1F979A; Mon, 9 May 2022 01:49:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388696AbiEFDsx (ORCPT + 99 others); Thu, 5 May 2022 23:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384740AbiEFDsv (ORCPT ); Thu, 5 May 2022 23:48:51 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1643140DC; Thu, 5 May 2022 20:45:09 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R431e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0VCPqtyH_1651808701; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VCPqtyH_1651808701) by smtp.aliyun-inc.com(127.0.0.1); Fri, 06 May 2022 11:45:06 +0800 From: Jiapeng Chong To: peterz@infradead.org Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] x86/events: Replace snprintf() with sysfs_emit() Date: Fri, 6 May 2022 11:44:59 +0800 Message-Id: <20220506034459.63236-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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 coccicheck complains about the use of snprintf() in sysfs show functions. Fix the coccicheck warning: ./arch/x86/events/amd/core.c:1300:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- arch/x86/events/amd/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 262e39a85031..47ef8aee15d2 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -1297,7 +1297,7 @@ static ssize_t branches_show(struct device *cdev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu.lbr_nr); + return sysfs_emit(buf, "%d\n", x86_pmu.lbr_nr); } static DEVICE_ATTR_RO(branches); -- 2.20.1.7.g153144c