Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memstick: move the dereference below the NULL test

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 <yongjun_wei@trendmicro.com.cn>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Wei Yongjun and committed by
Linus Torvalds
940da353 507063b2

+2 -1
+2 -1
drivers/memstick/host/r592.c
··· 454 454 /* Executes one TPC (data is read/written from small or large fifo) */ 455 455 static void r592_execute_tpc(struct r592_device *dev) 456 456 { 457 - bool is_write = dev->req->tpc >= MS_TPC_SET_RW_REG_ADRS; 457 + bool is_write; 458 458 int len, error; 459 459 u32 status, reg; 460 460 ··· 463 463 return; 464 464 } 465 465 466 + is_write = dev->req->tpc >= MS_TPC_SET_RW_REG_ADRS; 466 467 len = dev->req->long_data ? 467 468 dev->req->sg.length : dev->req->data_len; 468 469