Messages in this thread Patch in this message | | | Subject | Re: [PATCH] fsi: master: replace snprintf in show functions with sysfs_emit | From | Joe Perches <> | Date | Thu, 21 Oct 2021 21:49:34 -0700 |
| |
On Fri, 2021-10-22 at 02:50 +0000, cgel.zte@gmail.com wrote: > From: Ye Guojin <ye.guojin@zte.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
| |