Re: [PATCH] drm,fbdev: td043mtea1: Convert sprintf() family to sysfs_emit() family

From: Zhijian Li (Fujitsu)
Date: Tue Mar 19 2024 - 00:02:02 EST




On 19/03/2024 11:43, Li Zhijian wrote:
> diff --git
> a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
> b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
> index 477789cff8e0..040a17a05baa 100644
> --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
> +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
> @@ -228,14 +228,10 @@ static ssize_t tpo_td043_gamma_show(struct device
> *dev,
> int ret;
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(ddata->gamma); i++) {
> - ret = snprintf(buf + len, PAGE_SIZE - len, "%u ",
> - ddata->gamma[i]);
> - if (ret < 0)
> - return ret;
> - len += ret;
> - }
> - buf[len - 1] = '\n';
> + for (i = 0; i < ARRAY_SIZE(ddata->gamma); i++)
> + len = sysfs_emit_at(buf, len, "%u ", ddata->gamma[i]);

It should be
len += sysfs_emit_at(buf, len, "%u ", ddata->gamma[i]);

just posted V2 to fix this.


Thanks
Zhijian

> + if (len)
> + buf[len - 1] = '\n';
>