linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Use NULL to compare with pointer-typed value rather than 0
@ 2018-08-17 13:27 zhong jiang
  2018-08-18  6:17 ` zhong jiang
  0 siblings, 1 reply; 2+ messages in thread
From: zhong jiang @ 2018-08-17 13:27 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel

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 <zhongjiang@huawei.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: Use NULL to compare with pointer-typed value rather than 0
  2018-08-17 13:27 [PATCH] block: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
@ 2018-08-18  6:17 ` zhong jiang
  0 siblings, 0 replies; 2+ messages in thread
From: zhong jiang @ 2018-08-18  6:17 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel

On 2018/8/17 21:27, zhong jiang wrote:
> 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 <zhongjiang@huawei.com>
> ---
>  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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-18  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 13:27 [PATCH] block: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
2018-08-18  6:17 ` zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).