* [PATCH] ide: Use NULL to compare with pointer-typed value rather than 0
@ 2018-08-17 13:23 zhong jiang
2018-08-18 6:16 ` zhong jiang
0 siblings, 1 reply; 2+ messages in thread
From: zhong jiang @ 2018-08-17 13:23 UTC (permalink / raw)
To: davem; +Cc: benh, paulus, mpe, linux-ide, 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/ide/pmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index c5b902b..673734b 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1682,7 +1682,7 @@ static int pmac_ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
/* We won't need pci_dev if we switch to generic consistent
* DMA routines ...
*/
- if (dev == NULL || pmif->dma_regs == 0)
+ if (dev == NULL || pmif->dma_regs == NULL)
return -ENODEV;
/*
* Allocate space for the DBDMA commands.
--
1.7.12.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ide: Use NULL to compare with pointer-typed value rather than 0
2018-08-17 13:23 [PATCH] ide: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
@ 2018-08-18 6:16 ` zhong jiang
0 siblings, 0 replies; 2+ messages in thread
From: zhong jiang @ 2018-08-18 6:16 UTC (permalink / raw)
To: davem; +Cc: benh, paulus, mpe, linux-ide, linux-kernel
On 2018/8/17 21:23, 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/ide/pmac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
> index c5b902b..673734b 100644
> --- a/drivers/ide/pmac.c
> +++ b/drivers/ide/pmac.c
> @@ -1682,7 +1682,7 @@ static int pmac_ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
> /* We won't need pci_dev if we switch to generic consistent
> * DMA routines ...
> */
> - if (dev == NULL || pmif->dma_regs == 0)
> + if (dev == NULL || pmif->dma_regs == NULL)
> return -ENODEV;
> /*
> * Allocate space for the DBDMA commands.
Maybe if (!dev || !pmif->dma_regs) is better, Will repost in v2.
Thanks,
zhong jiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-18 6:16 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:23 [PATCH] ide: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
2018-08-18 6:16 ` 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).