diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-09-10 00:49:23 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2012-10-27 07:01:03 -0400 |
commit | 9ad90238bf4faa488680cf6dddf0d2b137960cc8 (patch) | |
tree | dcf47055eee354255d213988df8c544812ec9986 | |
parent | 6f0c0580b70c89094b3422ba81118c7b959c7556 (diff) |
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r-- | arch/arm/mach-davinci/board-dm644x-evm.c | 5 |
1 files 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 f22572cee49d..f8a99ee6bffc 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c | |||
@@ -519,13 +519,11 @@ static int dm6444evm_msp430_get_pins(void) | |||
519 | char buf[4]; | 519 | char buf[4]; |
520 | struct i2c_msg msg[2] = { | 520 | struct i2c_msg msg[2] = { |
521 | { | 521 | { |
522 | .addr = dm6446evm_msp->addr, | ||
523 | .flags = 0, | 522 | .flags = 0, |
524 | .len = 2, | 523 | .len = 2, |
525 | .buf = (void __force *)txbuf, | 524 | .buf = (void __force *)txbuf, |
526 | }, | 525 | }, |
527 | { | 526 | { |
528 | .addr = dm6446evm_msp->addr, | ||
529 | .flags = I2C_M_RD, | 527 | .flags = I2C_M_RD, |
530 | .len = 4, | 528 | .len = 4, |
531 | .buf = buf, | 529 | .buf = buf, |
@@ -536,6 +534,9 @@ static int dm6444evm_msp430_get_pins(void) | |||
536 | if (!dm6446evm_msp) | 534 | if (!dm6446evm_msp) |
537 | return -ENXIO; | 535 | return -ENXIO; |
538 | 536 | ||
537 | msg[0].addr = dm6446evm_msp->addr; | ||
538 | msg[1].addr = dm6446evm_msp->addr; | ||
539 | |||
539 | /* Command 4 == get input state, returns port 2 and port3 data | 540 | /* Command 4 == get input state, returns port 2 and port3 data |
540 | * S Addr W [A] len=2 [A] cmd=4 [A] | 541 | * S Addr W [A] len=2 [A] cmd=4 [A] |
541 | * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P | 542 | * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P |