[PATCH] block: move the dereference below the NULL test

Subsystems: block layer, the rest

STALE5089d

2 messages, 2 authors, 2012-09-07 · open the first message on its own page

[PATCH] block: move the dereference below the NULL test

From: Wei Yongjun <hidden>
Date: 2012-09-07 07:04:08

From: Wei Yongjun <redacted>

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 <redacted>
---
 drivers/block/swim3.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 89ddab1..25a522d 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -1090,13 +1090,14 @@ static const struct block_device_operations floppy_fops = {
 static void swim3_mb_event(struct macio_dev* mdev, int mb_state)
 {
 	struct floppy_state *fs = macio_get_drvdata(mdev);
-	struct swim3 __iomem *sw = fs->swim3;
+	struct swim3 __iomem *sw;
 
 	if (!fs)
 		return;
 	if (mb_state != MB_FD)
 		return;
 
+	sw = fs->swim3;
 	/* Clear state */
 	out_8(&sw->intr_enable, 0);
 	in_8(&sw->intr);

RE: [PATCH] block: move the dereference below the NULL test

From: yongjun_wei@trendmicro.com.cn <hidden>
Date: 2012-09-07 09:16:13

Sorry, I see the patch fix this issue has already exists in the maillist,
please ignore it, thanks.

-----Original Message-----
From: Wei Yongjun [mailto:weiyj.lk@gmail.com] 
Sent: 2012年9月7日 15:04
To: grant.likely@secretlab.ca; rob.herring@calxeda.com
Cc: Yongjun Wei (RD-CN); linux-kernel@vger.kernel.org; devicetree-discuss@lists.ozlabs.org
Subject: [PATCH] block: move the dereference below the NULL test

From: Wei Yongjun <redacted>

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)



TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help