From patchwork Fri Oct 22 02:50:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 1545540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Re+5vIOu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hd3PY2fdZz9sWJ for ; Mon, 25 Oct 2021 16:27:45 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hd3PY18Qmz2yHB for ; Mon, 25 Oct 2021 16:27:45 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Re+5vIOu; dkim-atps=neutral X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1032; helo=mail-pj1-x1032.google.com; envelope-from=cgel.zte@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Re+5vIOu; dkim-atps=neutral Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Hb8470J27z2yMc for ; Fri, 22 Oct 2021 13:51:02 +1100 (AEDT) Received: by mail-pj1-x1032.google.com with SMTP id np13so1896524pjb.4 for ; Thu, 21 Oct 2021 19:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ITT8WFbH6v/m4W4m1F5isVWCJcMpG8vLUaedk3t279E=; b=Re+5vIOuhdqcWgD+3/wdcNJkyaWZ69J2ILnTCXWiwT4BoOez2wt7v2Tfic0k3KbY+F BN3o/3BALTwOGLcT8lCOYP1rUQW53T7XnEG+EnSCxb+LD7smlE5xdP8hJakiLI/VNjpO /aS/3c5/FdrBfVdTBD/M/Cb02TFIK4T3zsBY2rTPR8CyH9VinIpyEm5FHi3jvTw8UvLU uaQ90uytLM68Z2+q9MYA1ZwviSyiTg2jfmWF0CSlowplp1+qp8ehgbjJZ/446hN1oCY9 +sAPuhmo9Tv5/zob1k16v+XHS/WQNAdh2DEwWWqTMmLQsMUxjxJTe1dKB7tMD2VOfXz5 /fXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ITT8WFbH6v/m4W4m1F5isVWCJcMpG8vLUaedk3t279E=; b=dT8fyNYm0LdNAIa03/1xbK/Q60ZxEl654VylWXwgb+hU0+Y5NZL2ZbCUcsVkNDejfg OinYPv7IqjfeeQvLswHrgLe7EE50wJa7Dc4DDkYVcvOfHaa1wllmAe5vPwuketaYspy3 1HRBPyO6SKrvcXUu07gRxI2+3JYjvla3MuSOx4FJpbSuAZrH36pk2NEg4gTPKNefh8uD nixZgajIkV8uIoGXCZ3qQ1Nm499RU6lMnMzczMCwdi2qDShhC70W98iIK4Uoe8R8DVmt gyE33LwbKwa4FDsdGDFNyXeydSzEb1a+uGGDWcHy0p7bLC+WNxHLqrAtBdawKV0VL8mW AwbQ== X-Gm-Message-State: AOAM533dgrcVMehrJBWSgRQc+5ZarMdUIt9R9xZRJ3mf8HdYnbCWiTAO 1uUzFyhUl6LL/sfuYCwg2G0= X-Google-Smtp-Source: ABdhPJxNvTaC6qILH2cCRf6i1cALOiHbtEPaweQu+wCi7WyE86XMIMSyEjbfuvJyIIuWAlDipIlNEQ== X-Received: by 2002:a17:90b:3809:: with SMTP id mq9mr11264359pjb.7.1634871059929; Thu, 21 Oct 2021 19:50:59 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id bp19sm6997961pjb.46.2021.10.21.19.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 19:50:59 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: ye.guojin@zte.com.cn To: jk@ozlabs.org Subject: [PATCH] fsi: master: replace snprintf in show functions with sysfs_emit Date: Fri, 22 Oct 2021 02:50:52 +0000 Message-Id: <20211022025052.1063370-1-ye.guojin@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 25 Oct 2021 16:27:43 +1100 X-BeenThere: linux-fsi@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair@popple.id.au, Zeal Robot , linux-kernel@vger.kernel.org, Ye Guojin , linux-fsi@lists.ozlabs.org Errors-To: linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "linux-fsi" From: Ye Guojin coccicheck complains about the use of snprintf() in sysfs show functions: WARNING use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot Signed-off-by: Ye Guojin --- drivers/fsi/fsi-master-ast-cf.c | 3 +-- drivers/fsi/fsi-master-gpio.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c index 24292acdbaf8..1725785128f9 100644 --- a/drivers/fsi/fsi-master-ast-cf.c +++ b/drivers/fsi/fsi-master-ast-cf.c @@ -1083,8 +1083,7 @@ static ssize_t external_mode_show(struct device *dev, { struct fsi_master_acf *master = dev_get_drvdata(dev); - return snprintf(buf, PAGE_SIZE - 1, "%u\n", - master->external_mode ? 1 : 0); + return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0); } static ssize_t external_mode_store(struct device *dev, diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c index 7d5f29b4b595..865acb37e0ee 100644 --- a/drivers/fsi/fsi-master-gpio.c +++ b/drivers/fsi/fsi-master-gpio.c @@ -718,8 +718,7 @@ static ssize_t external_mode_show(struct device *dev, { struct fsi_master_gpio *master = dev_get_drvdata(dev); - return snprintf(buf, PAGE_SIZE - 1, "%u\n", - master->external_mode ? 1 : 0); + return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0); } static ssize_t external_mode_store(struct device *dev,