update hdmi drivers: mod gpio control for phonepad project
[firefly-linux-kernel-4.4.55.git] / drivers / video / au1100fb.c
index 378f27745a1db94e18e8fd3b70d0318c2e88b490..a699aab638205c01b0765610cd9846a5468a8944 100644 (file)
@@ -715,8 +715,11 @@ int au1100fb_setup(char *options)
                        }
                        /* Mode option (only option that start with digit) */
                        else if (isdigit(this_opt[0])) {
-                               mode = kmalloc(strlen(this_opt) + 1, GFP_KERNEL);
-                               strncpy(mode, this_opt, strlen(this_opt) + 1);
+                               mode = kstrdup(this_opt, GFP_KERNEL);
+                               if (!mode) {
+                                       print_err("memory allocation failed");
+                                       return -ENOMEM;
+                               }
                        }
                        /* Unsupported option */
                        else {