From patchwork Wed Dec 7 08:32:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 30697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp59594wrr; Wed, 7 Dec 2022 00:45:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jDOih8NfpbkkrnpiJCGfr2muQtLQL4Mw6Jfz1sX3++u8LRm1xnDlkIQUYNOIBGm8jsrhz X-Received: by 2002:a17:90a:4889:b0:20d:d531:97cc with SMTP id b9-20020a17090a488900b0020dd53197ccmr100131684pjh.164.1670402737331; Wed, 07 Dec 2022 00:45:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670402737; cv=none; d=google.com; s=arc-20160816; b=oe9HN04vPp+z3OlVGH7K+fkBrKHvFgOWnMKGDwghupUZF9MXkbAJKZhs2f9uL36bzf ZrA3WoMq1zzFQN4OsNz8eUV/DliBKhcyb7GuLY71G+yN3HoZE56SiPl1/MFON3KI+YJ+ 04m6sPJJZahpnNHTcE8KP1/yxmwZL+ztv1Bcm4tTtdHsMoWgkTrIwMHL01pjyyS7SCcN OLOkAmZRRnXWtzWchTkstJ/ZkLXWgo9fYs4uIIFPgLp/DLHM9VRswbB/ZDi+se1RQU/N l26C/NVdTbrWUvbOO/AVEd+wCV/fG41j2ECUsgqEB7F+nCjCBtS5/cnQfWrf2dKenkEm 6+Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=4s5djkmRZEajXMCfEP4t9fu2EHlrNyrPbxxZbVmOhE4=; b=NUpmPVIh/jJgvBoDNM30Kf8y0p4buUHrvThu7lkHLYHoZbMEb7d+z1x+PWzOHNjqOD pB37aRKiwwsgbbrmvvD1sXsWpp6VFwF9gTJKu/x/ZjxK3jMRdOuaadLchQjnQoUGullm TEXNW2v/5yQqXpc7KaGvrLbMsJQVjnAzy/G1CkLOgAx2CwYRXlNWpQ0C3Ki+dexQlRqZ 2ByDzfmwfrt5UsZzupNnNjAsEGGcjZXQyKVlApQtRvNkBYMlrGMhLnRIdgNABrgywYqI PUazavd+ZC9wJJj9QLON04S3CW9KEH9x59Lz5AhkHadxqipsc8StjXjqrdGiZk6/WD0l xs4w== 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a656683000000b0046ec76d7a09si19668304pgw.665.2022.12.07.00.45.24; Wed, 07 Dec 2022 00:45:37 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbiLGIca (ORCPT + 99 others); Wed, 7 Dec 2022 03:32:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiLGIc3 (ORCPT ); Wed, 7 Dec 2022 03:32:29 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70CA2FC1D; Wed, 7 Dec 2022 00:32:26 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NRrBH5cfzz4y0tt; Wed, 7 Dec 2022 16:32:23 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B78WGpX027211; Wed, 7 Dec 2022 16:32:16 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Wed, 7 Dec 2022 16:32:18 +0800 (CST) Date: Wed, 7 Dec 2022 16:32:18 +0800 (CST) X-Zmail-TransId: 2af963904f92fffffffff2deebab X-Mailer: Zmail v1.0 Message-ID: <202212071632188074249@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?utf-8?q?=5BPATCH=5D_RDMA/hfi1=3A_use_sysfs=5Femit=28=29_to_instea?= =?utf-8?q?d_of_scnprintf=28=29?= X-MAIL: mse-fl1.zte.com.cn 2B78WGpX027211 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63904F97.000 by FangMail milter! X-FangMail-Envelope: 1670401943/4NRrBH5cfzz4y0tt/63904F97.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63904F97.000/4NRrBH5cfzz4y0tt X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751544220833213316?= X-GMAIL-MSGID: =?utf-8?q?1751544220833213316?= From: ye xingchen Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- drivers/infiniband/hw/hfi1/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/driver.c b/drivers/infiniband/hw/hfi1/driver.c index 8e71bef9d982..bcc6bc0540f0 100644 --- a/drivers/infiniband/hw/hfi1/driver.c +++ b/drivers/infiniband/hw/hfi1/driver.c @@ -112,7 +112,7 @@ static int hfi1_caps_get(char *buffer, const struct kernel_param *kp) cap_mask &= ~HFI1_CAP_LOCKED_SMASK; cap_mask |= ((cap_mask & HFI1_CAP_K2U) << HFI1_CAP_USER_SHIFT); - return scnprintf(buffer, PAGE_SIZE, "0x%lx", cap_mask); + return sysfs_emit(buffer, "0x%lx\n", cap_mask); } struct pci_dev *get_pci_dev(struct rvt_dev_info *rdi)