]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
fbdev: offb: Simplify offb_init_fb()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 21 Oct 2023 06:53:37 +0000 (08:53 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 7 Nov 2023 13:42:34 +0000 (14:42 +0100)
Turn a strcpy()+strncat()+'\0' into an equivalent snprintf().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/offb.c

index dcb1b81d35db57cc15dba8040c92875b86e02e6b..b421b46d88efcad3cd6a623cc049573f6ccd8f35 100644 (file)
@@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
        fix = &info->fix;
        var = &info->var;
 
-       if (name) {
-               strcpy(fix->id, "OFfb ");
-               strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
-               fix->id[sizeof(fix->id) - 1] = '\0';
-       } else
+       if (name)
+               snprintf(fix->id, sizeof(fix->id), "OFfb %s", name);
+       else
                snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);