Commit e98631d8 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Greg Kroah-Hartman

staging: dgap: fix returned errno code in dgap_parsefile()

The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.

Also, the smatch tool complains with the following warning:

dgap_parsefile() warn: returning -1 instead of -ENOMEM is sloppy
Signed-off-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f937918
...@@ -642,7 +642,7 @@ static int dgap_parsefile(char **in) ...@@ -642,7 +642,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
...@@ -861,7 +861,7 @@ static int dgap_parsefile(char **in) ...@@ -861,7 +861,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = TNODE; p->type = TNODE;
...@@ -883,7 +883,7 @@ static int dgap_parsefile(char **in) ...@@ -883,7 +883,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = CUNODE; p->type = CUNODE;
...@@ -914,7 +914,7 @@ static int dgap_parsefile(char **in) ...@@ -914,7 +914,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = LNODE; p->type = LNODE;
...@@ -933,7 +933,7 @@ static int dgap_parsefile(char **in) ...@@ -933,7 +933,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = CNODE; p->type = CNODE;
...@@ -975,7 +975,7 @@ static int dgap_parsefile(char **in) ...@@ -975,7 +975,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = MNODE; p->type = MNODE;
...@@ -1054,7 +1054,7 @@ static int dgap_parsefile(char **in) ...@@ -1054,7 +1054,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = PNODE; p->type = PNODE;
...@@ -1076,7 +1076,7 @@ static int dgap_parsefile(char **in) ...@@ -1076,7 +1076,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = JNODE; p->type = JNODE;
...@@ -1098,7 +1098,7 @@ static int dgap_parsefile(char **in) ...@@ -1098,7 +1098,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = ANODE; p->type = ANODE;
...@@ -1120,7 +1120,7 @@ static int dgap_parsefile(char **in) ...@@ -1120,7 +1120,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = INTRNODE; p->type = INTRNODE;
...@@ -1141,7 +1141,7 @@ static int dgap_parsefile(char **in) ...@@ -1141,7 +1141,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = TSNODE; p->type = TSNODE;
...@@ -1163,7 +1163,7 @@ static int dgap_parsefile(char **in) ...@@ -1163,7 +1163,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = CSNODE; p->type = CSNODE;
...@@ -1185,7 +1185,7 @@ static int dgap_parsefile(char **in) ...@@ -1185,7 +1185,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = BSNODE; p->type = BSNODE;
...@@ -1207,7 +1207,7 @@ static int dgap_parsefile(char **in) ...@@ -1207,7 +1207,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = USNODE; p->type = USNODE;
...@@ -1229,7 +1229,7 @@ static int dgap_parsefile(char **in) ...@@ -1229,7 +1229,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = FSNODE; p->type = FSNODE;
...@@ -1251,7 +1251,7 @@ static int dgap_parsefile(char **in) ...@@ -1251,7 +1251,7 @@ static int dgap_parsefile(char **in)
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL); p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) if (!p->next)
return -1; return -ENOMEM;
p = p->next; p = p->next;
p->type = VSNODE; p->type = VSNODE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment