OMAP: DSS2: OMAPFB: Add null pointer check

A null pointer check added. And using kstrdup()
instead of kmalloc() & strcpy()

Signed-off-by: Samreen <samreen@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
This commit is contained in:
Samreen 2010-11-16 12:49:07 +01:00 committed by Tomi Valkeinen
parent ed3f909546
commit 36e8c27f3b
1 changed files with 3 additions and 2 deletions

View File

@ -2132,8 +2132,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
char *str, *options, *this_opt;
int r = 0;
str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
strcpy(str, def_mode);
str = kstrdup(def_mode, GFP_KERNEL);
if (!str)
return -ENOMEM;
options = str;
while (!r && (this_opt = strsep(&options, ",")) != NULL) {