lkml.org 
[lkml]   [2018]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
From
Date
On 08/18/2018 09:16 AM, 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.

Your description stopped to match the patch in v2.
Actually, this X == NULL to !x preference is largely spocific to netdev...
Although, IDE maintainer is the same now person. :-)

> 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..ca36a97 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 || !pmif->dma_regs)
> return -ENODEV;
> /*
> * Allocate space for the DBDMA commands.

MBR, Sergei

\
 
 \ /
  Last update: 2018-08-18 17:54    [W:0.041 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site