Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1568898pxb; Thu, 4 Nov 2021 04:50:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb6DJHpARmPq9PqTqt0BOkap5RBo3DIaB4mBHgZaRie/a+DlnmidqFTdy8nSz6R0wjTCPJ X-Received: by 2002:a02:a8a:: with SMTP id 132mr3431353jaw.24.1636026649966; Thu, 04 Nov 2021 04:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636026649; cv=none; d=google.com; s=arc-20160816; b=e0SS50udGi+dY33niQg5tKzk7IGjwqQxwSM9G/pL8WCtqhWtObr7nLTH1FtZ5CVNOg IYiYuxDaK+4e+3YfRnYf4weq8mInHIUZUFkVgMm3TcqQ+CFmQ95fg9mjkCZu/9wUjyme +LI5jviAPfZq4w+Nx+KTosBwR1DyCgH9jBWLLb7bQDy4aMcFcSmMpx9xAxf7f0poXhy2 6Nwh8x7V6EWmffCsgoGGn1ypmsJAkMDixNmKILKpNf3PkxYwkuPXhc7w5F+Ej6gWg6lR 1MdW9LZ6l7VjV7TMhO+7CdKkYgWzFVrwyenuKE1TwLD01LVdK8cFLp8aBIpsr+dcCc/v uKgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PdowUE+txHFKqxZ9G9alg9aKUaAkTecpGwT4qv6lwxw=; b=y7URLI4FncX6CofiwCM68wSatkM5OUFsTIn/dMdwFWb33+1lH0OaHJzv7yIjGlDDcH UaXMVQA1zdz8hdloeSvnCrY703HgdgSI6RogtwJ2B6QX2ajQrlBjK7cTtZUhcipFVVgH a8Ne+BX8KP+pIWfLlVpoby47QO6PCFHzkTFBp6/l7kCWRllZq1wTBSXb0kxMvSBk9kwO lVzyEStjKWa9vz9iDXsctJhTnYA8lcWg6X2d4EYJHMzu6PN9USou6+i1aBCredzryCJ+ EAYgnEtX/rEanz3jm6XuvShN9krYA9g5Hf42ltDHavRU+QDIk3/F2hjA6KtsTrIv0Qbe MjBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WIDxbb6e; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si6918623ilu.115.2021.11.04.04.50.36; Thu, 04 Nov 2021 04:50:49 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WIDxbb6e; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231402AbhKDLum (ORCPT + 99 others); Thu, 4 Nov 2021 07:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbhKDLul (ORCPT ); Thu, 4 Nov 2021 07:50:41 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF74EC061714; Thu, 4 Nov 2021 04:48:03 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id h14so3789417qtb.3; Thu, 04 Nov 2021 04:48:03 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=PdowUE+txHFKqxZ9G9alg9aKUaAkTecpGwT4qv6lwxw=; b=WIDxbb6eQAjNWl4DFkHaw/n76DzT3eBXIwGKCuu8e8aTIDfxmL5SNS52BICHET/lAA RnLfSKwidQPFryty2aV6MrLrO66zw0a5FB9cv3MGFfmH00Pd+UAliKs9X7Zw0coZBVTe QON7+VnpSQBxgoUoeppC4YWJPNAb2cQIQA7/nPsSU12PnvzsKuSm1nqzpNXlzHPv9v+l SdSufhSFnZ9h8g4B8lcPx+SEBvJBYfkG0G7zG/yDO0mL2ISmjL1DVT8y+M8XoefPLze/ TXQgf9q6P0NmVBusCHx5n3zLlO814rcjbl2f8m8r3m3tImb0mb1qZOP0+xkgdihfi/Qp NWoQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=PdowUE+txHFKqxZ9G9alg9aKUaAkTecpGwT4qv6lwxw=; b=WLkwRq6ETE6B/tubSxlRN2DKpc5kh9o1ti+2a9pmIduZAVzw00axqsuAq5XB1mno8U 7o9KjS6UvdUM59la8XEOOpUKSEraphWWFWpkWwzXR/ijMOX7uIpN5OkBO634bCeFyCc6 axX5EGqc+xz+iqRXdq1Z6HBt330ZSHAn+63UzUNAWpShWydOwgohgKnBR0TpcjOZgYi9 zcTHf3653QJJ6Xuj75wMfnP9EK157Vu0KXTnLKq5IaRHdtxSk4XLhRxMhgwV19mpJ3L7 GaiFVyTK8vrbLr+IaFQBBv6U4vKYmd7uul3ucCdySzwBuGMx/CYWHG0piq3rdTR12QhZ T3qA== X-Gm-Message-State: AOAM530nzFS0zA2IB1gsU93BN+GsJppTYFEH/LGMswQkHFjBnGkpJQzr eYB6/X9Kpi74oOVJJrHsQVU= X-Received: by 2002:a05:622a:607:: with SMTP id z7mr17500336qta.237.1636026483078; Thu, 04 Nov 2021 04:48:03 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id y8sm3794776qtx.0.2021.11.04.04.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 04:48:02 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: yao.jing2@zte.com.cn To: johan@kernel.org Cc: andrew@aj.id.au, cgel.zte@gmail.com, fancer.lancer@gmail.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, joe@perches.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, macro@orcam.me.uk, pali@kernel.org, yao.jing2@zte.com.cn, zealci@zte.com.cn Subject: [PATCH v3] serial: 8250: replace snprintf in show functions with sysfs_emit Date: Thu, 4 Nov 2021 11:47:54 +0000 Message-Id: <20211104114754.30983-1-yao.jing2@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jing Yao 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: Jing Yao --- Changes since v1 & v2: - Remove excess and wrong parameter 'PAGE_SIZE' in sysfs_emit function. - Revise the wrong patch Subject. drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 5775cbff8f6e..3d58f383152e 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3099,7 +3099,7 @@ static ssize_t rx_trig_bytes_show(struct device *dev, if (rxtrig_bytes < 0) return rxtrig_bytes; - return snprintf(buf, PAGE_SIZE, "%d\n", rxtrig_bytes); + return sysfs_emit(buf, "%d\n", rxtrig_bytes); } static int do_set_rxtrig(struct tty_port *port, unsigned char bytes) -- 2.25.1