Skip to content

Commit

Permalink
ARM: davinci: dm644x evm: move pointer dereference below NULL check
Browse files Browse the repository at this point in the history
Pointer 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 <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
  • Loading branch information
Wei Yongjun authored and Sekhar Nori committed Oct 27, 2012
1 parent 6f0c058 commit 9ad9023
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/arm/mach-davinci/board-dm644x-evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,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,
Expand All @@ -536,6 +534,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
Expand Down

0 comments on commit 9ad9023

Please sign in to comment.