Commit 9ad90238 authored by Wei Yongjun's avatar Wei Yongjun Committed by Sekhar Nori

ARM: davinci: dm644x evm: move pointer dereference below NULL check

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 6f0c0580
...@@ -519,13 +519,11 @@ static int dm6444evm_msp430_get_pins(void) ...@@ -519,13 +519,11 @@ static int dm6444evm_msp430_get_pins(void)
char buf[4]; char buf[4];
struct i2c_msg msg[2] = { struct i2c_msg msg[2] = {
{ {
.addr = dm6446evm_msp->addr,
.flags = 0, .flags = 0,
.len = 2, .len = 2,
.buf = (void __force *)txbuf, .buf = (void __force *)txbuf,
}, },
{ {
.addr = dm6446evm_msp->addr,
.flags = I2C_M_RD, .flags = I2C_M_RD,
.len = 4, .len = 4,
.buf = buf, .buf = buf,
...@@ -536,6 +534,9 @@ static int dm6444evm_msp430_get_pins(void) ...@@ -536,6 +534,9 @@ static int dm6444evm_msp430_get_pins(void)
if (!dm6446evm_msp) if (!dm6446evm_msp)
return -ENXIO; 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 /* Command 4 == get input state, returns port 2 and port3 data
* S Addr W [A] len=2 [A] cmd=4 [A] * 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 * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment