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:
parent
ed3f909546
commit
36e8c27f3b
1 changed files with 3 additions and 2 deletions
|
@ -2132,8 +2132,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
|
||||||
char *str, *options, *this_opt;
|
char *str, *options, *this_opt;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL);
|
str = kstrdup(def_mode, GFP_KERNEL);
|
||||||
strcpy(str, def_mode);
|
if (!str)
|
||||||
|
return -ENOMEM;
|
||||||
options = str;
|
options = str;
|
||||||
|
|
||||||
while (!r && (this_opt = strsep(&options, ",")) != NULL) {
|
while (!r && (this_opt = strsep(&options, ",")) != NULL) {
|
||||||
|
|
Loading…
Reference in a new issue