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: 1431231 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by patchwork2.kernel.org (Postfix) with ESMTP id E1A55DF28C for ; Mon, 10 Sep 2012 10:42:35 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8AAgYHB006144 for ; Mon, 10 Sep 2012 05:42:34 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8AAgYkj001791 for ; Mon, 10 Sep 2012 05:42:34 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Mon, 10 Sep 2012 05:42:33 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8AAgX8Q010846 for ; Mon, 10 Sep 2012 05:42:33 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 3B4DC8062E for ; Mon, 10 Sep 2012 05:42:33 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 5901D80626 for ; Sun, 9 Sep 2012 23:49:26 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id q8A4nQe3023329 for ; Sun, 9 Sep 2012 23:49:26 -0500 (CDT) Received: from psmtp.com (na3sys009amx185.postini.com [74.125.149.166]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id q8A4nOSx021917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 9 Sep 2012 23:49:24 -0500 Received: from mail-qa0-f52.google.com ([209.85.216.52]) (using TLSv1) by na3sys009amx185.postini.com ([74.125.148.10]) with SMTP; Sun, 09 Sep 2012 19:49:25 HDT Received: by qabg14 with SMTP id g14so657507qab.4 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: , , X-pstn-levels: (S:12.38316/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 1 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.0050) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] X-Mailman-Approved-At: Mon, 10 Sep 2012 05:42:26 -0500 CC: , , , X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com 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