From patchwork Sat Dec 14 04:43:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3344621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D565D9F243 for ; Sat, 14 Dec 2013 04:44:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 182C620774 for ; Sat, 14 Dec 2013 04:44:00 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DADF20772 for ; Sat, 14 Dec 2013 04:43:59 +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 1Vrh4r-0007Fy-VE; Sat, 14 Dec 2013 04:43:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vrh4p-0006MT-Ag; Sat, 14 Dec 2013 04:43:43 +0000 Received: from mail-bk0-x22d.google.com ([2a00:1450:4008:c01::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vrh4k-0006Ll-9W for linux-arm-kernel@lists.infradead.org; Sat, 14 Dec 2013 04:43:41 +0000 Received: by mail-bk0-f45.google.com with SMTP id mx13so1657446bkb.4 for ; Fri, 13 Dec 2013 20:43:12 -0800 (PST) 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=VCOd5kR77wZuBHNLZS4RCIdRb07vu26CMh1S+wFJEmI=; b=WHI9H6/l91tkb0pRiIC1ZbVBLnPNvtnncQWK5tzIY0+JOoRU+SYjgrTjmPF1KZwsD8 4ixI4O4o7DDeibjoB9+6f25CQPfIYJ2G+ljPw8QU7CexuJaDVeHhk4em69n9emhpzTRz lzHL7kknhjc/Rfve+u3RbFhd6NfSO8dk8v13cDMM+gcyRhpUwZgOJf0sFCbYQTnTEJGV mpMcP6tvI9OdHJHTU4yp5X1nDn2MhkKEfUYhigjoO/r6Kg0fN0Gi0FxVg5L/oX8lN5d7 /kyfOAKiurZDlH8CvUzW57pNCmVB4ZS9vuGz58+H+kPQw+WESVpag4LL72IOoCOg5Sze uJZQ== MIME-Version: 1.0 X-Received: by 10.204.103.7 with SMTP id i7mr1333020bko.14.1386996191435; Fri, 13 Dec 2013 20:43:11 -0800 (PST) Received: by 10.204.74.130 with HTTP; Fri, 13 Dec 2013 20:43:11 -0800 (PST) Date: Sat, 14 Dec 2013 12:43:11 +0800 Message-ID: Subject: [PATCH -next] ARM: pxa: fix return value check in em_x270_sensor_init() From: Wei Yongjun To: eric.y.miao@gmail.com, linux@arm.linux.org.uk, haojian.zhuang@gmail.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131213_234338_490179_ACBCA5E9 X-CRM114-Status: GOOD ( 12.23 ) X-Spam-Score: -2.0 (--) Cc: yongjun_wei@trendmicro.com.cn, linux-kernel@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.1 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=ham 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 regulator_get() 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 --- arch/arm/mach-pxa/em-x270.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 6915a9f..339b422 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c @@ -971,9 +971,9 @@ static int em_x270_sensor_init(void) gpio_direction_output(cam_reset, 0); em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); - if (em_x270_camera_ldo == NULL) { + if (IS_ERR(em_x270_camera_ldo)) { gpio_free(cam_reset); - return -ENODEV; + return PTR_ERR(em_x270_camera_ldo); } ret = regulator_enable(em_x270_camera_ldo);