[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ccb3ab4d533de55260b98c7168bfa4460c5f3fcc.camel@perches.com>
Date: Thu, 21 Oct 2021 21:49:34 -0700
From: Joe Perches <joe@...ches.com>
To: cgel.zte@...il.com, jk@...abs.org
Cc: joel@....id.au, alistair@...ple.id.au, eajames@...ux.ibm.com,
linux-fsi@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Ye Guojin <ye.guojin@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] fsi: master: replace snprintf in show functions with
sysfs_emit
On Fri, 2021-10-22 at 02:50 +0000, cgel.zte@...il.com wrote:
> From: Ye Guojin <ye.guojin@....com.cn>
>
> coccicheck complains about the use of snprintf() in sysfs show
> functions:
> WARNING use scnprintf or sprintf
[]
> diff --git 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);
external_mode is already bool so this ?: isn't necessary.
> diff --git 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);
here too
Powered by blists - more mailing lists