From patchwork Tue Dec 27 02:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 638335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D174BC4332F for ; Tue, 27 Dec 2022 02:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231566AbiL0Cdl (ORCPT ); Mon, 26 Dec 2022 21:33:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbiL0Cd3 (ORCPT ); Mon, 26 Dec 2022 21:33:29 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43B9610CA; Mon, 26 Dec 2022 18:33:18 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Tue, 27 Dec 2022 10:32:17 +0800 (GMT+08:00) X-Originating-IP: [182.148.15.35] Date: Tue, 27 Dec 2022 10:32:17 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: "KaiLong Wang" To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: scsi_transport_sas: Fix the following coccicheck warning: X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <4a48b6f.39a.185516c69cd.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCXn+AxWapj12IKAA--.229W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQADB2FEYx0G1gAVsb X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org drivers/scsi/scsi_transport_sas.c:525:9-17: WARNING: use scnprintf or sprintf drivers/scsi/scsi_transport_sas.c:572:8-16: WARNING: use scnprintf or sprintf drivers/scsi/scsi_transport_sas.c:1180:9-17: WARNING: use scnprintf or sprintf Signed-off-by: KaiLong Wang --- drivers/scsi/scsi_transport_sas.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 74b99f2b0b74..5504067adcf1 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -522,7 +522,7 @@ show_sas_device_type(struct device *dev, struct sas_phy *phy = transport_class_to_phy(dev); if (!phy->identify.device_type) - return snprintf(buf, 20, "none\n"); + return sysfs_emit(buf, "none\n"); return get_sas_device_type_names(phy->identify.device_type, buf); } static DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL); @@ -569,7 +569,7 @@ show_sas_phy_enable(struct device *dev, struct device_attribute *attr, { struct sas_phy *phy = transport_class_to_phy(dev); - return snprintf(buf, 20, "%d\n", phy->enabled); + return sysfs_emit(buf, "%d\n", phy->enabled); } static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, @@ -1177,7 +1177,7 @@ show_sas_rphy_device_type(struct device *dev, struct sas_rphy *rphy = transport_class_to_rphy(dev); if (!rphy->identify.device_type) - return snprintf(buf, 20, "none\n"); + return sysfs_emit(buf, "none\n"); return get_sas_device_type_names( rphy->identify.device_type, buf); }