From patchwork Fri Sep 21 04:57:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 185572 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EE52E2C007D for ; Fri, 21 Sep 2012 14:57:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492Ab2IUE5w (ORCPT ); Fri, 21 Sep 2012 00:57:52 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:58019 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803Ab2IUE5v (ORCPT ); Fri, 21 Sep 2012 00:57:51 -0400 Received: by qaas11 with SMTP id s11so981741qaa.19 for ; Thu, 20 Sep 2012 21:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=LTCmTljO3/ZkAkVwi6PDz0jfc5XcJ986e+9SxvD0bIU=; b=xVlI+5Ks3RSp1n1STwpGhSVF3H4AuxgCXE03g3tPuN7X7Gkt0IaMtDtUYisMFz4LMz LUokLjOChSPMDJPPEwCQ503ClUp6rsv3Toh9ievhsWvPbYGyiC5ZddLnjCprQYEBrFn2 5PUL4S642pqPTjGPTAIl42SBYxvDTsAs557nuZsnNoQuiXXYFjqSy3EdVB72opIMmOuy d1URNvnhWDYDguUrx0cjkF56HSbRFZFWsdDY6k8fWF6sy70WpFS7hhDjdVMCMreOUlOG s/BdUivpC37NFIHyY641/a9pQbE7Bzy/KoQt7k+lpDPXGMhnJFlXKaD4fCv3ZmStkns6 Vrsw== MIME-Version: 1.0 Received: by 10.224.196.132 with SMTP id eg4mr9676869qab.93.1348203471145; Thu, 20 Sep 2012 21:57:51 -0700 (PDT) Received: by 10.229.146.194 with HTTP; Thu, 20 Sep 2012 21:57:51 -0700 (PDT) Date: Fri, 21 Sep 2012 12:57:51 +0800 Message-ID: Subject: [PATCH] sparc: fix the return value of module_alloc() From: Wei Yongjun To: davem@davemloft.net Cc: yongjun_wei@trendmicro.com.cn, sparclinux@vger.kernel.org Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: 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;