[PATCH] block: Use NULL to compare with pointer-typed value rather than 0

Subsystems: block layer, the rest

STALE2946d

2 messages, 1 author, 2018-08-18 · open the first message on its own page

[PATCH] block: Use NULL to compare with pointer-typed value rather than 0

From: zhong jiang <hidden>
Date: 2018-08-17 13:39:57

We should use NULL to compare with pointer-typed value rather than
0. The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <redacted>
---
 drivers/block/ataflop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index dfb2c26..cca93e3 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1355,7 +1355,7 @@ static int floppy_revalidate(struct gendisk *disk)
 
 	if (test_bit(drive, &changed_floppies) ||
 	    test_bit(drive, &fake_change) ||
-	    p->disktype == 0) {
+	    p->disktype == NULL) {
 		if (UD.flags & FTD_MSG)
 			printk(KERN_ERR "floppy: clear format %p!\n", UDT);
 		BufferDrive = -1;
-- 
1.7.12.4

Re: [PATCH] block: Use NULL to compare with pointer-typed value rather than 0

From: zhong jiang <hidden>
Date: 2018-08-18 06:17:24

On 2018/8/17 21:27, zhong jiang wrote:
quoted hunk
We should use NULL to compare with pointer-typed value rather than
0. The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <redacted>
---
 drivers/block/ataflop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index dfb2c26..cca93e3 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1355,7 +1355,7 @@ static int floppy_revalidate(struct gendisk *disk)
 
 	if (test_bit(drive, &changed_floppies) ||
 	    test_bit(drive, &fake_change) ||
-	    p->disktype == 0) {
+	    p->disktype == NULL) {
 		if (UD.flags & FTD_MSG)
 			printk(KERN_ERR "floppy: clear format %p!\n", UDT);
 		BufferDrive = -1;
 Maybe if  (!p->disktype) is better,  So will change it in v2.

Thanks,
zhong jiang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help