linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
@ 2018-08-18  6:16 zhong jiang
  2018-08-18 15:53 ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: zhong jiang @ 2018-08-18  6:16 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..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.
-- 
1.7.12.4


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

* Re: [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18  6:16 [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
@ 2018-08-18 15:53 ` Sergei Shtylyov
  2018-08-18 16:15   ` Joe Perches
  2018-08-18 16:25   ` Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2018-08-18 15:53 UTC (permalink / raw)
  To: zhong jiang, davem; +Cc: benh, paulus, mpe, linux-ide, linux-kernel

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

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

* Re: [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18 15:53 ` Sergei Shtylyov
@ 2018-08-18 16:15   ` Joe Perches
  2018-08-18 16:21     ` Sergei Shtylyov
  2018-08-18 16:25   ` Sergei Shtylyov
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2018-08-18 16:15 UTC (permalink / raw)
  To: Sergei Shtylyov, zhong jiang, davem
  Cc: benh, paulus, mpe, linux-ide, linux-kernel

On Sat, 2018-08-18 at 18:53 +0300, Sergei Shtylyov wrote:
> 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

Perhaps discourage trivial changes to this old subsystem.

checkpatch could bleat something if a patch was submitted for ide
if the IDE MAINTAINERS entry was marked obsolete.
---
diff --git a/MAINTAINERS b/MAINTAINERS
index e9336962d0f2..3c4992cf5249 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6933,7 +6933,7 @@ M:	"David S. Miller" <davem@davemloft.net>
 L:	linux-ide@vger.kernel.org
 Q:	http://patchwork.ozlabs.org/project/linux-ide/list/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
-S:	Maintained
+S:	Maintained / Obsolete (prefer LIBATA)
 F:	Documentation/ide/
 F:	drivers/ide/
 F:	include/linux/ide.h


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

* Re: [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18 16:15   ` Joe Perches
@ 2018-08-18 16:21     ` Sergei Shtylyov
  2018-08-18 16:26       ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2018-08-18 16:21 UTC (permalink / raw)
  To: Joe Perches, zhong jiang, davem
  Cc: benh, paulus, mpe, linux-ide, linux-kernel

On 08/18/2018 07:15 PM, Joe Perches 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
> 
> Perhaps discourage trivial changes to this old subsystem.
> 
> checkpatch could bleat something if a patch was submitted for ide
> if the IDE MAINTAINERS entry was marked obsolete.

   Note that the IDE fixes are still OK...

> ---
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e9336962d0f2..3c4992cf5249 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6933,7 +6933,7 @@ M:	"David S. Miller" <davem@davemloft.net>
>  L:	linux-ide@vger.kernel.org
>  Q:	http://patchwork.ozlabs.org/project/linux-ide/list/
>  T:	git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
> -S:	Maintained
> +S:	Maintained / Obsolete (prefer LIBATA)

   What about "S: Odd Fixes"? Perhaps it better reflects the reality...

>  F:	Documentation/ide/
>  F:	drivers/ide/
>  F:	include/linux/ide.h

MBR, Sergei

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

* Re: [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18 15:53 ` Sergei Shtylyov
  2018-08-18 16:15   ` Joe Perches
@ 2018-08-18 16:25   ` Sergei Shtylyov
  1 sibling, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2018-08-18 16:25 UTC (permalink / raw)
  To: zhong jiang, davem; +Cc: benh, paulus, mpe, linux-ide, linux-kernel

On 08/18/2018 06:53 PM, Sergei Shtylyov 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.

  And your subject as well...

>    Actually, this X ==  NULL to !x preference is largely spocific to netdev...

   Specific, of course. :-)

> Although, IDE maintainer is the same now person. :-)  

  "The same person now" I wanted to type. :-)

>  
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
[...]

MBR, Sergei

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

* Re: [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18 16:21     ` Sergei Shtylyov
@ 2018-08-18 16:26       ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2018-08-18 16:26 UTC (permalink / raw)
  To: Sergei Shtylyov, zhong jiang, davem
  Cc: benh, paulus, mpe, linux-ide, linux-kernel

On Sat, 2018-08-18 at 19:21 +0300, Sergei Shtylyov wrote:
> On 08/18/2018 07:15 PM, Joe Perches 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. :-)  
[]
> > > > diff --git 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.
[]
> > Perhaps discourage trivial changes to this old subsystem.
> > 
> > checkpatch could bleat something if a patch was submitted for ide
> > if the IDE MAINTAINERS entry was marked obsolete.
> 
>    Note that the IDE fixes are still OK...

The checkpatch obsolete message is

<filename> is marked as 'obsolete' in the MAINTAINERS hierarchy.  No unnecessary modifications please.

---
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index e9336962d0f2..3c4992cf5249 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -6933,7 +6933,7 @@ M:	"David S. Miller" <davem@davemloft.net>
> >  L:	linux-ide@vger.kernel.org
> >  Q:	http://patchwork.ozlabs.org/project/linux-ide/list/
> >  T:	git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
> > -S:	Maintained
> > +S:	Maintained / Obsolete (prefer LIBATA)
> 
>    What about "S: Odd Fixes"? Perhaps it better reflects the reality...

That'd be up to David.


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18  6:16 [PATCHv2] ide: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
2018-08-18 15:53 ` Sergei Shtylyov
2018-08-18 16:15   ` Joe Perches
2018-08-18 16:21     ` Sergei Shtylyov
2018-08-18 16:26       ` Joe Perches
2018-08-18 16:25   ` Sergei Shtylyov

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).