Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp815987pxb; Wed, 3 Feb 2021 19:58:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0KVPr/R312FJ3VT4ADC8xP/vxcZo2ErlxKabBOxINRsodm39lHGmHyXrWLE8UuTzDhJMJ X-Received: by 2002:a05:6402:1bde:: with SMTP id ch30mr6208697edb.151.1612411116760; Wed, 03 Feb 2021 19:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612411116; cv=none; d=google.com; s=arc-20160816; b=0k5EVo/oMIOAQsXMfJ9VDHBq7YdUI6BBKaoO/D+OZUlUvcXOOyCiRLMMpntqL05L55 ZtcawzVcXZqipi0EUWJ5eE0FvlzZNckpjfqWfteuCadG3RLJBTisdkWi5XBOodSln/gd XkarereI5v0lJTirYCkAL6G17RBlzQ8B6E4FMG+2OvH38NI5M3spwWNidxSh4B58gz3U yYHb/w/UJWBX8grhiTYj4t3th/MfBgEZE87Lko916h1vo7z0hDjrNODbi/y+kHzum4eq lck7CBzm3/9MGd0jGT2f92YAAAE/s6cgMMvINC1OMUtwvnEKhwX49WwWi1RmbyRwzbnL YnTA== 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=nl4BL0BeEPROMGbViBcdB9MLGKeCGC+zQmNipVC0myk=; b=JenTi883/ISc5YvSjysKWJZo9XnCSV6cgHSOR2FhhtO9Qh/HdcsWIg4JwnMCu6bFnB vyGK8HlaxrXH9HCNUpT7HTo4vHBc9FSvcT621+/HnSPMe3ojs03mmUwJG0IRU+w8S7Ow aooYe3rMYswQ9CqHowQe0yId1xU5yr0KmySR/kyHs7UOO9c3kW9Zdshj+UE7uhZ4DpwX 3uPtt2QJyWYMjLWY0oz5eEbaUMy52wjCTcc4vCaH+t7KpXXV6PMB893MSaElrdoZF9DA KK1+oJZ3ofvTQsLTIJCU1Hb/3dAyTNBTv4R69eGx17TeQidJPAz4q8CGruWkBc8H4J2w BM9w== 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 bx7si2641631edb.206.2021.02.03.19.58.12; Wed, 03 Feb 2021 19:58:36 -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 S234619AbhBDClQ (ORCPT + 99 others); Wed, 3 Feb 2021 21:41:16 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:53602 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231299AbhBDClP (ORCPT ); Wed, 3 Feb 2021 21:41:15 -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=e01e01424;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UNoQw31_1612406418; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0UNoQw31_1612406418) by smtp.aliyun-inc.com(127.0.0.1); Thu, 04 Feb 2021 10:40:27 +0800 From: Jiapeng Chong To: satishkh@cisco.com Cc: sebaddel@cisco.com, kartilak@cisco.com, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] [SCSI] fnic: convert sysfs sprintf/snprintf family to sysfs_emit Date: Thu, 4 Feb 2021 10:40:16 +0800 Message-Id: <1612406416-111761-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/fnic/fnic_attrs.c:43:8-16: WARNING: use scnprintf or sprintf. ./drivers/scsi/fnic/fnic_attrs.c:35:8-16: WARNING: use scnprintf or sprintf. ./drivers/scsi/fnic/fnic_attrs.c:29:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/scsi/fnic/fnic_attrs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/fnic/fnic_attrs.c b/drivers/scsi/fnic/fnic_attrs.c index aea0c3b..6e6e125 100644 --- a/drivers/scsi/fnic/fnic_attrs.c +++ b/drivers/scsi/fnic/fnic_attrs.c @@ -26,13 +26,13 @@ static ssize_t fnic_show_state(struct device *dev, struct fc_lport *lp = shost_priv(class_to_shost(dev)); struct fnic *fnic = lport_priv(lp); - return snprintf(buf, PAGE_SIZE, "%s\n", fnic_state_str[fnic->state]); + return sysfs_emit(buf, "%s\n", fnic_state_str[fnic->state]); } static ssize_t fnic_show_drv_version(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION); + return sysfs_emit(buf, "%s\n", DRV_VERSION); } static ssize_t fnic_show_link_state(struct device *dev, @@ -40,8 +40,7 @@ static ssize_t fnic_show_link_state(struct device *dev, { struct fc_lport *lp = shost_priv(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%s\n", (lp->link_up) - ? "Link Up" : "Link Down"); + return sysfs_emit(buf, "%s\n", (lp->link_up) ? "Link Up" : "Link Down"); } static DEVICE_ATTR(fnic_state, S_IRUGO, fnic_show_state, NULL); -- 1.8.3.1