Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3898175pxb; Mon, 1 Nov 2021 23:55:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLgldDLehjZEUjxm8lVZZfhhXicOJvdF3rlv1+CyrTm7z/g89cqX7NySwgubryjI8uZue9 X-Received: by 2002:a17:906:2749:: with SMTP id a9mr42143531ejd.471.1635836105182; Mon, 01 Nov 2021 23:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635836105; cv=none; d=google.com; s=arc-20160816; b=eRnx6p6fiIp4ol0nDHRl7o3xiJe3M1cog4UhFPF7AVMVxE4xwZRPm7I0iXNTHZsb/b auWU5ZBS+Zery2Z7fZNjfHZQC2K7AcNIEnBaqKcT1XNjTZu+UAlF9wXXSHRwZL2ZKaNo axA+WHTja2Gf3LrnLJAWrMfPYsACRAAcjAxgWiUWaMTZ35dylDi9dz4ySg/WMPICaoVn u8U2pWMDyulec5K7s22UWAyha5UXuQ5ORfigUuAsDswE0RXtIUJAos9wMVWGQXf4gI9B kkdCrqpC3jgTmJQzOOcCZltB6zr/WLaQq2rd8b9a+Q3j/SF8tzcRwnUWmXtbKE7nHiMy AAoQ== 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=7pRVqNc+FppqVn66H2Dpc51B/il1e+yZxyBdV0UH4Zs=; b=PtxawiSROT5jtdDO4fBC/wRbdCCNPHacZ1lpG/lh55yL04rZVMXKVJBN1vvISvggJS 1Vb/xmalLHud0TD9iISfePO7nNrdBVcQ97v0cd5m+KzgbUOWUNZFl2lwWklYMnBuUr2I Q73uFHdojeHISp0ostYIVc2ZKHEpaOZFLb2YXFtPMz2MtmLB1YQcSbpG4xpjFF23BlLx CUvbnarHo+mVSGNikVujniHLoVbbnEeKARwwiVGbIMheCb5EU8oXhsBVTcTz9UtbRMw7 jXDUkVV7XPAFZbJS5sExr1N3M1mb9+B7suGkVFnYdKWjQXpL+/rzgxbCF3dWwqAQXVBK 7dVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="RG/BlteO"; 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 z5si2841990edc.323.2021.11.01.23.54.41; Mon, 01 Nov 2021 23:55:05 -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="RG/BlteO"; 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 S230005AbhKBGzP (ORCPT + 99 others); Tue, 2 Nov 2021 02:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbhKBGzN (ORCPT ); Tue, 2 Nov 2021 02:55:13 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C9B6C061714; Mon, 1 Nov 2021 23:52:35 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id v20so14503848plo.7; Mon, 01 Nov 2021 23:52:35 -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=7pRVqNc+FppqVn66H2Dpc51B/il1e+yZxyBdV0UH4Zs=; b=RG/BlteOYWXybOs02hqOHcpq1fDM5XeLjlj7Lu4ZkxFkDwW8CX7J8l3qvuYgvJFJJG s55fLOC8sGbhISonZXtcVOr2sbr/C1bwRTbTScTxWNUBJGNcbfymaE+b+mz2N9XAA8V3 Dvyd01ZDuo5IhX811DX7j0TTNjbFRWEK/bkosoTw5fWHkF/l6xx8u3QgOMzOSfxdop36 J7kHx/k4VC0Sd4AsUvFJxQwhflQRQ88ooc/FDJUtquG4F58TVDnNwnXejr9PbJ4zdRPL Mr6Inm/4FW13eitCQ1k2BDvZn1aKLXSLZDPO9xNC4Uchs1AheHl+b0Ne1dW4Gkxx1Vdb KQcQ== 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=7pRVqNc+FppqVn66H2Dpc51B/il1e+yZxyBdV0UH4Zs=; b=t4Nlb4jONteRWk2YEPK0GwrFeNP2uEQz4iHlvTDqUKhN/zXmNlwN7jTdBLZ7cvoEym /uTORoV3kUqSRSaZHfmORHcRYFCFApPDW2ecSZPgN+PFP57SLDEwyfXIEN1ByFbor9PN HomC/Hck+L5I8vGT7fu/RlG3K5xtMfscehJ2fJGggoR5diT+lxfZ/hQr07kJcG7MuRkN yHKeIDTR3t99B/awPQAfNg62eR+xSMEAgWQ2k9/e+oLH7OQcC/DmFcQIJnPLQKcvNkdg /Y1jS0GVyaqY376FQU059RXyIGWU4WZ0hJ7+jdMvYOT84DqAWI0uo8jmsM7mIh53mQkz 1kRQ== X-Gm-Message-State: AOAM532zPptV+KkGgbT2ybZu5X0gol6Hlv6Q4q488Ba6TMFaNjM5VASf ql+PvmHLbey36Yh1Egr50EQ= X-Received: by 2002:a17:902:a70e:b0:141:a01d:9d6c with SMTP id w14-20020a170902a70e00b00141a01d9d6cmr26762033plq.84.1635835954807; Mon, 01 Nov 2021 23:52:34 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id np17sm1461436pjb.7.2021.11.01.23.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 23:52:34 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: yao.jing2@zte.com.cn To: joe@perches.com Cc: andrew@aj.id.au, cgel.zte@gmail.com, fancer.lancer@gmail.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, johan@kernel.org, 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 v2] drivers: tty: replace snprintf in show functions with sysfs_emit Date: Tue, 2 Nov 2021 06:52:06 +0000 Message-Id: <20211102065206.3368-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 --- 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