From patchwork Mon Sep 10 04:49:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 1429801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 6A36BDF28C for ; Mon, 10 Sep 2012 04:52:45 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TAvwC-0008AS-Uu; Mon, 10 Sep 2012 04:49:33 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TAvw7-0008AD-2I for linux-arm-kernel@lists.infradead.org; Mon, 10 Sep 2012 04:49:30 +0000 Received: by qafk1 with SMTP id k1so697654qaf.15 for ; Sun, 09 Sep 2012 21:49:23 -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=somvndJgw80FR+JzbYq/Go/8//F8PyHYwJFZWycR64o=; b=E3ePEyOPOFzWx95gSfpjnNjO9FXutSO5AHq5pEFdTWYkqXe+qOnp+HreYkEB2OHqgG YDvqNacMSoB9Ymd769s79zn4LMr96uGl+lLoWYifosLcmDliOpC1yflWAnBFjdvUUCCZ bq0SHH2ybOrwhdW6wpmIaWT1SXG2HJXp4ky800+37lgSO5+YYGRX09WXSDAy7ubRy+VU ILirX5AlMMRHlokqpp4ow7gQ6DE7iB50in6hq8inwElFyXxYimUExlVMwidmJsc464kQ idIbReqPqsyfyNL097lDeOlW7VEaUHHriPmvMH5dNfbXTvApp6GRnXr8PmCWCVVFXUq6 roTw== MIME-Version: 1.0 Received: by 10.224.179.7 with SMTP id bo7mr10734359qab.96.1347252563793; Sun, 09 Sep 2012 21:49:23 -0700 (PDT) Received: by 10.229.146.194 with HTTP; Sun, 9 Sep 2012 21:49:23 -0700 (PDT) Date: Mon, 10 Sep 2012 12:49:23 +0800 Message-ID: Subject: [PATCH] ARM: davinci: dm644x: move the dereference below the NULL test From: Wei Yongjun To: nsekhar@ti.com, khilman@ti.com, linux@arm.linux.org.uk X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (weiyj.lk[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: yongjun_wei@trendmicro.com.cn, davinci-linux-open-source@linux.davincidsp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Wei Yongjun The dereference should be moved below the NULL test. spatch with a semantic match is used to found this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun --- arch/arm/mach-davinci/board-dm644x-evm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index d34ed55..b54dc03 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -518,13 +518,11 @@ static int dm6444evm_msp430_get_pins(void) char buf[4]; struct i2c_msg msg[2] = { { - .addr = dm6446evm_msp->addr, .flags = 0, .len = 2, .buf = (void __force *)txbuf, }, { - .addr = dm6446evm_msp->addr, .flags = I2C_M_RD, .len = 4, .buf = buf, @@ -535,6 +533,9 @@ static int dm6444evm_msp430_get_pins(void) if (!dm6446evm_msp) return -ENXIO; + msg[0].addr = dm6446evm_msp->addr; + msg[1].addr = dm6446evm_msp->addr; + /* Command 4 == get input state, returns port 2 and port3 data * S Addr W [A] len=2 [A] cmd=4 [A] * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P