From patchwork Fri Sep 21 04:57:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: sparc: fix the return value of module_alloc() Date: Thu, 20 Sep 2012 18:57:51 -0000 From: Wei Yongjun X-Patchwork-Id: 185572 Message-Id: To: davem@davemloft.net Cc: yongjun_wei@trendmicro.com.cn, sparclinux@vger.kernel.org From: Wei Yongjun 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 --- arch/sparc/kernel/module.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 15e0a16..df7e16c 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -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;