diff mbox series

video: omapfb: Use scnprintf() instead of snprintf()

Message ID 20211117121829.11141-1-guozhengkui@vivo.com (mailing list archive)
State Superseded
Headers show
Series video: omapfb: Use scnprintf() instead of snprintf() | expand

Commit Message

Guo Zhengkui Nov. 17, 2021, 12:17 p.m. UTC
Fix following warnings:
./drivers/video/fbdev/omap/omapfb_main.c:1382:8-16:
WARNING: use scnprintf or sprintf
./drivers/video/fbdev/omap/omapfb_main.c:1306:8-16:
WARNING: use scnprintf or sprintf

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/video/fbdev/omap/omapfb_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Geert Uytterhoeven Nov. 18, 2021, 8:33 a.m. UTC | #1
Hi Guo,

CC cocci

On Wed, Nov 17, 2021 at 1:58 PM Guo Zhengkui <guozhengkui@vivo.com> wrote:
> Fix following warnings:
> ./drivers/video/fbdev/omap/omapfb_main.c:1382:8-16:
> WARNING: use scnprintf or sprintf
> ./drivers/video/fbdev/omap/omapfb_main.c:1306:8-16:
> WARNING: use scnprintf or sprintf
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>

Thanks for your patch!

> --- a/drivers/video/fbdev/omap/omapfb_main.c
> +++ b/drivers/video/fbdev/omap/omapfb_main.c
> @@ -1303,7 +1303,7 @@ static ssize_t omapfb_show_panel_name(struct device *dev,
>  {
>         struct omapfb_device *fbdev = dev_get_drvdata(dev);
>
> -       return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
> +       return scnprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
>  }

I guess all of these should use sysfs_emit() instead.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
index b495c09e6102..a0d472943c60 100644
--- a/drivers/video/fbdev/omap/omapfb_main.c
+++ b/drivers/video/fbdev/omap/omapfb_main.c
@@ -1303,7 +1303,7 @@  static ssize_t omapfb_show_panel_name(struct device *dev,
 {
 	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
+	return scnprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
 }
 
 static ssize_t omapfb_show_bklight_level(struct device *dev,
@@ -1314,7 +1314,7 @@  static ssize_t omapfb_show_bklight_level(struct device *dev,
 	int r;
 
 	if (fbdev->panel->get_bklight_level) {
-		r = snprintf(buf, PAGE_SIZE, "%d\n",
+		r = scnprintf(buf, PAGE_SIZE, "%d\n",
 			     fbdev->panel->get_bklight_level(fbdev->panel));
 	} else
 		r = -ENODEV;
@@ -1348,7 +1348,7 @@  static ssize_t omapfb_show_bklight_max(struct device *dev,
 	int r;
 
 	if (fbdev->panel->get_bklight_level) {
-		r = snprintf(buf, PAGE_SIZE, "%d\n",
+		r = scnprintf(buf, PAGE_SIZE, "%d\n",
 			     fbdev->panel->get_bklight_max(fbdev->panel));
 	} else
 		r = -ENODEV;
@@ -1379,7 +1379,7 @@  static ssize_t omapfb_show_ctrl_name(struct device *dev,
 {
 	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name);
+	return scnprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name);
 }
 
 static struct device_attribute dev_attr_ctrl_name =