Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp51400pxb; Tue, 2 Feb 2021 22:32:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzU73pkve16acOE1IGM9ILXpk2Mr6Xm4sdweb7NHCmWiYMPwNT4TK+meXy3Bc9bIu6EcBcl X-Received: by 2002:a17:906:f950:: with SMTP id ld16mr1692407ejb.553.1612333941069; Tue, 02 Feb 2021 22:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612333941; cv=none; d=google.com; s=arc-20160816; b=WFQBq17W6Frmet2aul/k0zd6kxfNuFyfOnaj9RGclkjTCVR9Pgu3c040Er43Kul2fi cZVtkFKKnFlXcKCn+IZBTSbw0Odsu46Hp2ER/MLspZFWDT8nFjOgh/Io9JD2Sd6BJktP AGSW0DoHGFfzNRCf/Of4lXUHvchAXFs5Ej2bXn9CLJtggbDu9ZwCJJMFQ6Ulay0wQpgs 9mqUwzdqmVxAmG985FGaAC2XLKuKgKmPl436wEC+x8N77HE/8faA4g0zy7aC7TJ7Ps7t CotdxGDP2OlhjOT/KQC1p0TgimXuG+5Quw+1beNndYnlTBbBaozTYG6zGcemdr7fL5rm SpFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=TBM58zzXelRJczgqeBEGLL7L83/JYxaZX5IcNNls35M=; b=Q1T0mA2zEFb9xcAU+8gNqSQrRJoChJJqqGl+ltitaadiuQ0Y3dRxiQFYcVEMIJMozW nVuMXSdJ1K0xRN9NgwD7NCkZ+4FsOFukaqCqMBWAVXWfP4LmVpCFw2Zq7sR7FPajdlSO A9SbJKgstzTGSIuz7aUQmO29OTj3WeDbfjDn8jPjDiMuZe6yyGO1lqSLTJuA17Vakl+R GY6VwepwIpQg/SSuUDf5oe8BAtAENhPLgL/Kzr5Pfgq8cVFhrKgNIkNELl9fILr8a1Kt I5r8JJa0E27LsYRh3yyOg5g14OvEcc4bHYvTgPEivxykqR01l7+5tT9ftEQlaNvMJnX3 Hj+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si775994ejq.233.2021.02.02.22.31.57; Tue, 02 Feb 2021 22:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231560AbhBCG2y (ORCPT + 99 others); Wed, 3 Feb 2021 01:28:54 -0500 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:33278 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbhBCG2w (ORCPT ); Wed, 3 Feb 2021 01:28:52 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0UNkCTfN_1612333671; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0UNkCTfN_1612333671) by smtp.aliyun-inc.com(127.0.0.1); Wed, 03 Feb 2021 14:28:04 +0800 From: Jiapeng Chong To: tyreld@linux.ibm.com Cc: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] scsi: ibmvfc: convert sysfs sprintf/snprintf family to sysfs_emit Date: Wed, 3 Feb 2021 14:27:49 +0800 Message-Id: <1612333669-103403-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: ./drivers/scsi/ibmvscsi/ibmvfc.c: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/scsi/ibmvscsi/ibmvfc.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 65f168c..99f5575 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -3038,8 +3038,7 @@ static ssize_t ibmvfc_show_host_partition_name(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.partition_name); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.partition_name); } static ssize_t ibmvfc_show_host_device_name(struct device *dev, @@ -3048,8 +3047,7 @@ static ssize_t ibmvfc_show_host_device_name(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.device_name); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.device_name); } static ssize_t ibmvfc_show_host_loc_code(struct device *dev, @@ -3058,8 +3056,7 @@ static ssize_t ibmvfc_show_host_loc_code(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.port_loc_code); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.port_loc_code); } static ssize_t ibmvfc_show_host_drc_name(struct device *dev, @@ -3068,8 +3065,7 @@ static ssize_t ibmvfc_show_host_drc_name(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.drc_name); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.drc_name); } static ssize_t ibmvfc_show_host_npiv_version(struct device *dev, @@ -3077,7 +3073,7 @@ static ssize_t ibmvfc_show_host_npiv_version(struct device *dev, { struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%d\n", be32_to_cpu(vhost->login_buf->resp.version)); + return sysfs_emit(buf, "%d\n", be32_to_cpu(vhost->login_buf->resp.version)); } static ssize_t ibmvfc_show_host_capabilities(struct device *dev, @@ -3085,7 +3081,7 @@ static ssize_t ibmvfc_show_host_capabilities(struct device *dev, { struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities)); + return sysfs_emit(buf, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities)); } /** @@ -3105,7 +3101,7 @@ static ssize_t ibmvfc_show_log_level(struct device *dev, int len; spin_lock_irqsave(shost->host_lock, flags); - len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->log_level); + len = sysfs_emit(buf, "%d\n", vhost->log_level); spin_unlock_irqrestore(shost->host_lock, flags); return len; } -- 1.8.3.1