From patchwork Fri Oct 25 09:31:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3094691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3BCD9BF924 for ; Fri, 25 Oct 2013 09:32:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D86102025A for ; Fri, 25 Oct 2013 09:32:22 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7642520254 for ; Fri, 25 Oct 2013 09:32:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VZdkg-00027h-6k; Fri, 25 Oct 2013 09:32:18 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VZdkd-00078t-Mk; Fri, 25 Oct 2013 09:32:15 +0000 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VZdkb-000789-2e for linux-arm-kernel@lists.infradead.org; Fri, 25 Oct 2013 09:32:13 +0000 Received: by mail-ea0-f178.google.com with SMTP id a15so436484eae.37 for ; Fri, 25 Oct 2013 02:31: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=HIJ5W/U3wx66XXvYwxiPA13HM7eMBpxANiSaXMn7x0A=; b=h0LINhBd6UcuQqDLHidvJCCgPc/CAvKqCKpcHkPEkIsbyT/c2eHJS1DbEXv3Y7LkPk P2PjCMJmlAaXJotscRIirshjs5Y6cAy93SjDTa+1bfF36T7e/NROhqvaLXlXn8VH7KG0 364p7yW5DmPq4Jjvjeok6RpFvonunbkzFlW7J5SCMyw7k6UJzmvXVdOSTSeRBDXJTc5l vgtjIliZTYlapiVWPl6HkCbwaqZ/fStF8iYKTI53A2tid9p4s5xMKN3c49IVGNEMullm FZ07Cvj/YP53FBr4nH29TcRnu/IS+BO6Rhar2Q4APblfXxahUvGLBAC+zh7kBT088Oms HoeA== MIME-Version: 1.0 X-Received: by 10.205.24.131 with SMTP id re3mr3225488bkb.8.1382693511189; Fri, 25 Oct 2013 02:31:51 -0700 (PDT) Received: by 10.205.19.10 with HTTP; Fri, 25 Oct 2013 02:31:51 -0700 (PDT) Date: Fri, 25 Oct 2013 17:31:51 +0800 Message-ID: Subject: [PATCH] ARM: OMAP2+: smsc911x: fix return value check in gpmc_smsc911x_init() From: Wei Yongjun To: khilman@deeprootsystems.com, tony@atomide.com, linux@arm.linux.org.uk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131025_053213_249746_8781AE83 X-CRM114-Status: GOOD ( 10.88 ) X-Spam-Score: -2.0 (--) Cc: yongjun_wei@trendmicro.com.cn, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun In case of error, the function platform_device_register_resndata() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun Acked-by: Igor Grinberg --- arch/arm/mach-omap2/gpmc-smsc911x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c index ef99011..2757504 100644 --- a/arch/arm/mach-omap2/gpmc-smsc911x.c +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c @@ -83,7 +83,7 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg) pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config)); - if (!pdev) { + if (IS_ERR(pdev)) { pr_err("Unable to register platform device\n"); gpio_free(gpmc_cfg->gpio_reset); goto free2;