Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3934633pxb; Tue, 2 Nov 2021 00:45:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMD0ft/bphg/4vG3+DOmnrsv2fKM7sh6LFDgUExUQY0X4CPBMgznEb/6KwjjT7QpyPFbkb X-Received: by 2002:a92:cd86:: with SMTP id r6mr7165979ilb.149.1635839150143; Tue, 02 Nov 2021 00:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635839150; cv=none; d=google.com; s=arc-20160816; b=E5vZzrpGFnyArOSLTFd3BOiHyTDjip8SR37/piG1RJ6b4fX/45Wg2NJYdDszDrgmha gUZGDFpJ312vR9utQOfj4vmnjtjHSxQNeC0aUJh+1fH1fZl5pdHXNl2+Q77SkcHIExcD GGrrK61o8L+nlYNO2GF2jPcoRJNVtGkOnMF2szntijJqr2WlB6ypWlD4/y2qgepIp3Xn Fwou/Mx+YHJoqOKAdYmK1t5/4qgL0rnTjt/BFDCTQc3tkU/wacHvlL3iAS/CoXGT5SlJ NPz9oQXAEhdGuK8w2RukcOnbplk9rRW4UHUyu/R+oqshY+TAdzeK97qg/eUiguANt7Do Q73g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yw5R2gnXcMTJVEbhg+nEGli3rNlNZQ0bFhLu4y7V8TE=; b=FgujG+ALaDZGuE2IDE0a+q9Q8EVF9ib7kOOq4V6imv2RNIVI5oW7YA6QI+hcuVBT5v p7jnWC0Z61zkgSbTDzRuSC0LADBpfAOU+Tpm4MhanbaUwWmIRlMW0syY2qdc8bMGXWEA g/26dJkM5JkFWhZhC+MYZP3yu+Amf8yDtk33N6McXPITGS2VU0sRAYZfyeldEi8Y/YBX GXVwFGpObQa7blbs48nyDJ3exVlIqWotfVBkD2LSzvE2s97w/LQyLxfO5zGnQNB5L9KJ w+t8WjUbEEuPlXLc2B9l7ZhYxGcde9Gm6xv62O8BZXRnbsY4Tk7iGfIekNkQe8CKu0xI fB1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Vq9/XrwB"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si3899536ilh.50.2021.11.02.00.45.39; Tue, 02 Nov 2021 00:45:50 -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=@kernel.org header.s=k20201202 header.b="Vq9/XrwB"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbhKBHrJ (ORCPT + 99 others); Tue, 2 Nov 2021 03:47:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:39604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbhKBHq4 (ORCPT ); Tue, 2 Nov 2021 03:46:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3936B60F56; Tue, 2 Nov 2021 07:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635839060; bh=K+5794DO0CyR1WowT7L3guGby6Lpr9bHzC6ZoG6dV/I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vq9/XrwBdPx+SkNvMiK+xsGpRUUBOGlQGR4cdQ3SMXR7+sqxCmdN8gPeNmm31qtpn hhQNVQveYd8Pz0qdYZwet6cfa2EyvDxAOTCuIwKrAhk+Tu2AvWIKQ8HyeVGBD9Vr7r Jihkch6CkRqk/5t8wXAHl8SJpGWZk6bTAGBuUZXqMow0HmXaQBpzrfPcrRbG1/nBmL q32n5vU5Gv2otj8+y6oaS2UZmR72sC49o/D66GectLPGoh/aJiBuzhTd/vUvZtB/kS 7nE1iobpde/jg3pEl65+3BvgYFgeRrfPui2jALpvoh/lmZ6KiP06hcicKdl9Du5+Pj LdJpHCpNwfoIg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1mhoSx-00071v-FO; Tue, 02 Nov 2021 08:44:20 +0100 Date: Tue, 2 Nov 2021 08:44:19 +0100 From: Johan Hovold To: cgel.zte@gmail.com Cc: joe@perches.com, andrew@aj.id.au, fancer.lancer@gmail.com, gregkh@linuxfoundation.org, jirislaby@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: Re: [PATCH v2] drivers: tty: replace snprintf in show functions with sysfs_emit Message-ID: References: <20211102065206.3368-1-yao.jing2@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211102065206.3368-1-yao.jing2@zte.com.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 02, 2021 at 06:52:06AM +0000, cgel.zte@gmail.com wrote: > 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 > --- What changed since v1? Always include a changelog here. Also you ignored my comment on the patch Subject. Including "drivers: " is never correct. You should also mention which driver you're changing since it's not done subtree-wide for tty. Again, look at the git log for the driver you're changing. In this case it should have been something like: serial: 8250: use sysfs_emit... > 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) Johan