Skip to content

Commit

Permalink
sparc: fix the return value of module_alloc()
Browse files Browse the repository at this point in the history
In case of error, function module_alloc() in other platform never
returns ERR_PTR(), and all of the user only check for NULL, so
we'd better return NULL instead of ERR_PTR().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Sep 21, 2012
1 parent dfa520a commit a9e8d1a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions arch/sparc/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ void *module_alloc(unsigned long size)
return NULL;

ret = module_map(size);
if (!ret)
ret = ERR_PTR(-ENOMEM);
else
if (ret)
memset(ret, 0, size);

return ret;
Expand Down

0 comments on commit a9e8d1a

Please sign in to comment.