From patchwork Sun Dec 25 08:52:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 36463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp452581wrt; Sun, 25 Dec 2022 01:08:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXvXb/9aV5WhE4XFjeWQjElI6MxDcbY3X5luzHCUEXRW8RZMqenesfpo9Ecn8TpEisAEHB+9 X-Received: by 2002:a05:6402:34f:b0:461:57c1:84ea with SMTP id r15-20020a056402034f00b0046157c184eamr13321158edw.3.1671959315139; Sun, 25 Dec 2022 01:08:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671959315; cv=none; d=google.com; s=arc-20160816; b=AFT75FZuHK1jjF78+o3goYIUqeaPEKtpH+M9u38f9RljmTcRpQMFByEDsB5l97xzoU jAXB3dB4W1CslofXG9xBH9oHfT5HqXxcEQKTSfjQUh4XWAiMaRvEAJOKniIS33neKtuB tlfnPjfGcJCiQ0K+MaxbEFjcaQSq+XAoWZ4cri/EB7ntimJVMCDCkILvecb5vd92a+tB jMgO2dWtTK9hYCjftP8VxlN+SjHMxvQywWXFDVpPGffQS7DAC7jP2AQA26tcMG3dlhoH sSLEUWWrpFdrli4Us8xVV9XxZ6BdkZvg7m8fbKBooI4SK5dr9I7sxfWBXKmGaPm4Gqs0 O4sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=ZfGKLzyxjFDCLp5wxd3KEHK6yAEi9CVPrABg+JtxinU=; b=a+vw4Zk/zlnMSuAtLfFq7XNHs+4iQ9kTe6xhMyLUem7Y2T9j2qNPKVxdjgDzXN9gIc dHEMuJBxVMu/AnfdOIYY1DxGj+6rXqymDok5hL5skIMOpRBRDTHtKPQIvc+mzpq/nGxF GH576YThDYe7EtlagCAbwMUP3kP2wK1NB7V4De7GzwPKugBMupvmJVPSakNWeiOz6dRx gf+tX8irroi3RRpGSWdC16ole9ZCX1gv6Ge6+ZjWiWqPnDnEh9lSu6AEZSBcWkX4kYid hu+jpyQhnVEb9qoGNwQw0zqWWS+vkv5gPoX9huHSwJe3U6e4W1PYyXrFwBnLbXBz9LNU E6iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=Ltr7bBrD; 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=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id el15-20020a056402360f00b0048321d887b5si3100756edb.516.2022.12.25.01.08.09; Sun, 25 Dec 2022 01:08:35 -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; dkim=fail header.i=@mailo.com header.s=mailo header.b=Ltr7bBrD; 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=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229969AbiLYIwe (ORCPT + 99 others); Sun, 25 Dec 2022 03:52:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiLYIwb (ORCPT ); Sun, 25 Dec 2022 03:52:31 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC9662C1; Sun, 25 Dec 2022 00:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671958337; bh=I5CZdbiOIfEVnkVnvSmsFr+giPvETja9h6PJ6ngbCfc=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=Ltr7bBrD75NWwpC30GJqRYeeNTqoM/zL8XeXO6W1AG6U128c0QB8KzAAhTMIrnPUc 5USAgzSTdNY4nxceHOnXMrBeHA4Gcq7qouVWCmEcHcLxwMXzOkf8QV3ukWDSC9rt0M bQQHaGx4mRzZLVtwrK4SJkG5w5S75rB8VLJYz9Tk= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 25 Dec 2022 09:52:17 +0100 (CET) X-EA-Auth: ltHlxnXlWaywR0ExxwSaRHOSNbllF5x5r4aSEgduth5IUWxFWrYNvc23zDL1RfjJn6VStuQPeqS9w+8dMWMbr/6mn3ffI4cg Date: Sun, 25 Dec 2022 14:22:12 +0530 From: Deepak R Varma To: Satish Kharat , Sesidhar Baddela , Karan Tilak Kumar , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH] scsi: fnic: Use sysfs_emit in show function callsbacks Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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?1753176411121918510?= X-GMAIL-MSGID: =?utf-8?q?1753176411121918510?= According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should strictly use sysfs_emit() instead of sprintf() family functions. So, make this change. Issue identified using the coccinelle device_attr_show.cocci script. Signed-off-by: Deepak R Varma --- drivers/scsi/fnic/fnic_attrs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.34.1 diff --git a/drivers/scsi/fnic/fnic_attrs.c b/drivers/scsi/fnic/fnic_attrs.c index a61e0c5e6506..1798d1e6318f 100644 --- a/drivers/scsi/fnic/fnic_attrs.c +++ b/drivers/scsi/fnic/fnic_attrs.c @@ -14,13 +14,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, @@ -28,7 +28,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) + return sysfs_emit(buf, "%s\n", (lp->link_up) ? "Link Up" : "Link Down"); }