sparc: fix the return value of module_alloc()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 20 Sep 2012 18:57:51 +0000 (18:57 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Sep 2012 19:14:20 +0000 (12:14 -0700)
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>
arch/sparc/kernel/module.c

index bae6ab600b7fa82dc7b6179ae4bb0949e8f674b0..f1ddc0d2367947d850e863aa4d0a897705074574 100644 (file)
@@ -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;